Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable styleguide templates #418

Open
wants to merge 1 commit into
base: 1.40
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bedrock.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
title: 'Styleguide',
url: '/styleguide',
homepage: '/styleguide/docs/introduction.html',
overrideStyleguideTemplates: false,
search: true,
colors: './content/scss/_colors.scss',
categoryOrder: [
Expand Down
6 changes: 6 additions & 0 deletions core/discovery/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ const defaultConfig = {
title: 'Styleguide',
url: '/styleguide',
homepage: '/styleguide/docs/introduction.html',
/**
* overrideStyleguideTemplates [boolean]
* Make Bedrock use the current directory's styleguide
* templates instead of Bedrock's core styleguide templates.
*/
overrideStyleguideTemplates: false,
/**
* search [boolean]
* Feature flag for search feature
Expand Down
14 changes: 10 additions & 4 deletions core/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ const config = require('./discovery/config');

const contentPath = 'content/';
const corePath = 'core/';
const absoluteCorePath = __dirname;
const compiledPath = 'tmp/';
const distPath = 'dist/';

const styleguideTemplatesPath =
config.styleguide.overrideStyleguideTemplates
? path.join(contentPath, 'templates/_styleguide')
: path.join(absoluteCorePath, 'templates/styleguide');

module.exports = {
content: {
path: contentPath,
Expand Down Expand Up @@ -70,10 +76,10 @@ module.exports = {
},
templates: {
styleguide: {
index: path.join(corePath, 'templates/styleguide/index.pug'),
doc: path.join(corePath, 'templates/styleguide/doc.pug'),
colors: path.join(corePath, 'templates/styleguide/colors.pug'),
componentGroup: path.join(corePath, 'templates/styleguide/component-group.pug')
index: path.join(styleguideTemplatesPath, 'index.pug'),
doc: path.join(styleguideTemplatesPath, 'doc.pug'),
colors: path.join(styleguideTemplatesPath, 'colors.pug'),
componentGroup: path.join(styleguideTemplatesPath, 'component-group.pug')
}
}
},
Expand Down