Skip to content
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 @@ -18,6 +18,7 @@ module.exports = {
},
styleguide: {
url: '/styleguide',
overrideStyleguideTemplates: false,
search: true,
colors: './content/scss/_colors.scss',
categoryOrder: [
Expand Down
4 changes: 2 additions & 2 deletions content/templates/_components/aov-icons/02-icon-font.pug
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include ../../../../core/templates/mixins/icon-overview
include /core/templates/mixins/icon-overview

if config.icons.generateIconFont
+iconsOverview('icon-font', 'Icon font')
else
p You don't seem to have icon fonts activated in <code>bedrock.config.js</code>. You can safely delete these documentation templates if you are not using an icon font, or document your icon font in your own manner.
p You don't seem to have icon fonts activated in <code>bedrock.config.js</code>. You can safely delete these documentation templates if you are not using an icon font, or document your icon font in your own manner.
12 changes: 6 additions & 6 deletions content/templates/_layouts/master.pug
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//- Globally expose mixins without output, needed for Bedrock to work
include ../../../core/templates/mixins/icon
include ../../../core/templates/mixins/render-page-tree
include ../../../core/templates/mixins/sample
include ../../../core/templates/mixins/styleguide-settings
include /core/templates/mixins/icon
include /core/templates/mixins/render-page-tree
include /core/templates/mixins/sample
include /core/templates/mixins/styleguide-settings
//- Use this include to add your own mixins
include ../_mixins/all

Expand Down Expand Up @@ -51,14 +51,14 @@ html(dir="ltr" lang="en" class=htmlClass ? htmlClass : '')

if config.pageTree && config.pageTree.layoutStyle == 'sidebar'
.br-prototype-wrapper
include ../../../core/templates/includes/prototype-nav
include /core/templates/includes/prototype-nav
.br-prototype-content
block body
else
block body
if config.pageTree && config.pageTree.layoutStyle == 'fixed'
.br-pagetree-fixed-wrapper
include ../../../core/templates/includes/prototype-nav
include /core/templates/includes/prototype-nav

= "\n"

Expand Down
2 changes: 1 addition & 1 deletion content/templates/page-index.pug
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extends /templates/_layouts/master

include ../../core/templates/mixins/render-page-tree
include /core/templates/mixins/render-page-tree

block append headerStyles
style.
Expand Down
31 changes: 31 additions & 0 deletions core/cli/bedrock
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#! /usr/bin/env node

'use strict';

const program = require('commander');

const cliVersion = require('../../package.json').version;

program
.version(cliVersion, '-v, --version');

program
.command('build', 'Build a static site');

program
.command('config', 'Report the configuration');

program
.command('content', 'Commands related to the main site content');

program
.command('serve', 'Run a development server');

program
.command('styleguide', 'Commands related to the styleguide content');

program
.command('components', 'Commands related to the styleguide components');

program
.parse(process.argv);
17 changes: 17 additions & 0 deletions core/cli/bedrock-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#! /usr/bin/env node

'use strict';

const program = require('commander');
const gulp = require('gulp');

const defineGulpTasks = require('../tasks/gulpfile');

program
.action(() => {
defineGulpTasks();
gulp.series('build')();
});

program
.parse(process.argv);
49 changes: 49 additions & 0 deletions core/cli/bedrock-components
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#! /usr/bin/env node

'use strict';

const program = require('commander');
const glob = require('glob');
const gulp = require('gulp');
const path = require('path');

const templates = require('../tasks/templates');
const paths = require('../paths');


program
.command('list')
.description('List the Pug templates under content/templates/_components')
.action(function () {
// glob.sync() is what gulp.src() uses, but the
console.log(glob.sync(paths.content.templates.allComponents, '**/*.pug'));
});

program
.command('build')
.description('Build the component Pug templates')
.action(function () {
gulp.task('templates:compile:styleguide', templates.compile.styleguide);
gulp.series('templates:compile:styleguide')();
});

program
.command('partials')
.description('Build the component Pug templates as partial HTML')
.action(function () {
gulp.task('templates:compile:partials', templates.compile.partials);
gulp.series('templates:compile:partials')();
});

program
.action(() => {
program.help()
});

if (process.argv.length === 2) {
program.help();
process.exit();
}

program
.parse(process.argv);
21 changes: 21 additions & 0 deletions core/cli/bedrock-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#! /usr/bin/env node

'use strict';

const program = require('commander');
const glob = require('glob');
const gulp = require('gulp');
const path = require('path');

const templates = require('../tasks/templates');
const paths = require('../paths');

const config = require('../discovery/config');

program
.action(() => {
console.log(config)
});

program
.parse(process.argv);
40 changes: 40 additions & 0 deletions core/cli/bedrock-content
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#! /usr/bin/env node

'use strict';

const program = require('commander');
const glob = require('glob');
const gulp = require('gulp');

const templates = require('../tasks/templates');
const paths = require('../paths');

program
.command('list')
.description('List the Pug templates under content/templates/')
.action(function () {
// glob.sync() is what gulp.src() uses, but the
// task filters paths starting with an underscore...
console.log(glob.sync(paths.content.templates.all));
});

program
.command('build')
.description('Build the Pug templates under content/temlates/')
.action(function () {
gulp.task('templates:compile:content', templates.compile.content);
gulp.series('templates:compile:content')();
});

program
.action(() => {
program.help()
});

if (process.argv.length === 2) {
program.help();
process.exit();
}

program
.parse(process.argv);
18 changes: 18 additions & 0 deletions core/cli/bedrock-serve
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /usr/bin/env node

'use strict';

const program = require('commander');
const gulp = require('gulp');

const browserSync = require('../tasks/browser-sync');
const defineGulpTasks = require('../tasks/gulpfile');

program
.action(() => {
defineGulpTasks();
gulp.parallel('server', 'compile-all', 'watch', browserSync)();
});

program
.parse(process.argv);
33 changes: 33 additions & 0 deletions core/cli/bedrock-styleguide
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#! /usr/bin/env node

'use strict';

const program = require('commander');
const glob = require('glob');
const gulp = require('gulp');
const path = require('path');

const templates = require('../tasks/templates');
const paths = require('../paths');

program
.command('build')
.description('Build the style guide, using the styleguide and docs Pug templates')
.action(function () {
gulp.task('templates:compile:docs', templates.compile.docs);
gulp.task('templates:compile:styleguide', templates.compile.styleguide);
gulp.parallel('templates:compile:docs', 'templates:compile:styleguide')();
});

program
.action(() => {
program.help()
});

if (process.argv.length === 2) {
program.help();
process.exit();
}

program
.parse(process.argv);
6 changes: 6 additions & 0 deletions core/discovery/default-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ const defaultConfig = {
*/
styleguide: {
url: '/styleguide',
/**
* 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
7 changes: 5 additions & 2 deletions core/discovery/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const config = require('./config');
const locals = require('../templates/locals');
const paths = require('../paths');

const MultipleBaseDirs = require('../templates/multi-basedirs');

module.exports = {
discover: function () {
const docFiles = glob.sync(paths.content.docs)
Expand All @@ -30,10 +32,11 @@ module.exports = {
parsedFile.body = marked(parsedFile.body);
} else if (extension === '.pug') {
const indentedPugMarkup = parsedFile.body.split('\n').map(line => ` ${line}`).join('\n');
const markupWithLayout = `extends /../core/templates/layouts/sample\n\nblock content\n${indentedPugMarkup}`;
const markupWithLayout = `extends /core/templates/layouts/sample\n\nblock content\n${indentedPugMarkup}`;

const compiler = pug.compile(markupWithLayout, Object.assign({}, config.pug, {
filename: docPath
filename: docPath,
plugins: [MultipleBaseDirs()]
}));
parsedFile.body = compiler(Object.assign({}, locals.getDefaultLocals(), {
pathname: `styleguide/docs/${filename}`
Expand Down
22 changes: 14 additions & 8 deletions core/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ const config = require('./discovery/config');

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

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

module.exports = {
content: {
path: contentPath,
Expand Down Expand Up @@ -60,20 +65,20 @@ module.exports = {
core: {
path: corePath,
js: {
entryFile: path.join(corePath, 'js/index.js'),
allFiles: path.join(corePath, 'js/**/*.js')
entryFile: path.join(absoluteCorePath, 'js/index.js'),
allFiles: path.join(absoluteCorePath, 'js/**/*.js')
},
scss: {
all: path.join(corePath, 'scss/**/*.scss'),
prism: path.join(corePath, 'scss/prism-styleguide.scss'),
prototype: path.join(corePath, 'scss/prototype.scss')
prism: path.join(absoluteCorePath, 'scss/prism-styleguide.scss'),
prototype: path.join(absoluteCorePath, 'scss/prototype.scss')
},
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 Expand Up @@ -102,6 +107,7 @@ module.exports = {
},
styleguide: path.join(distPath, config.styleguide.url),
docs: path.join(distPath, config.styleguide.url+'/docs/'),
partials: path.join(distPath, 'styleguide/partials/'),
assets: {
images: path.join(distPath, 'images/'),
fonts: path.join(distPath, 'fonts/'),
Expand Down
Loading