forked from usebedrock/bedrock
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a sub-command to render partials.
This is supposed to contribute to usebedrock#391.
- Loading branch information
Showing
4 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters