Adding gulp task help
This commit is contained in:
parent
fd3cc4f447
commit
4c5e176cea
38
gulpfile.js
38
gulpfile.js
@ -1,4 +1,4 @@
|
||||
const gulp = require('gulp'),
|
||||
const gulp = require('gulp-help')(require('gulp')),
|
||||
_ = require('lodash'),
|
||||
notify = require('gulp-notify'),
|
||||
folderToc = require('folder-toc'),
|
||||
@ -20,7 +20,7 @@ const gulp = require('gulp'),
|
||||
jscs = require('gulp-jscs'),
|
||||
config = require('./config');
|
||||
|
||||
gulp.task('default', ['server', 'docs'], function() {
|
||||
gulp.task('default', 'Auto-rebuild site on changes.', ['server', 'docs'], function() {
|
||||
gulp.watch(config.globs.other, ['static']);
|
||||
gulp.watch(_.flatten([
|
||||
config.globs.templates,
|
||||
@ -33,19 +33,19 @@ gulp.task('default', ['server', 'docs'], function() {
|
||||
gulp.watch(config.globs.js, ['scripts', 'docs']);
|
||||
});
|
||||
|
||||
gulp.task('docs', ['docs:files'], function() {
|
||||
gulp.task('docs', 'Build documentation into ./docs directory.', ['docs:files'], function() {
|
||||
folderToc('./docs', {
|
||||
filter: '*.html'
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('docs:files', function() {
|
||||
gulp.task('docs:files', false, function() {
|
||||
return gulp.src(config.globs.js)
|
||||
.pipe(docco())
|
||||
.pipe(gulp.dest('./docs'));
|
||||
});
|
||||
|
||||
gulp.task('server', ['build'], function() {
|
||||
gulp.task('server', 'Start development server.', ['build'], function() {
|
||||
gulp.watch(config.buildPath('**/*'), function(file) {
|
||||
return gulp.src(file.path).pipe(connect.reload());
|
||||
});
|
||||
@ -56,14 +56,14 @@ gulp.task('server', ['build'], function() {
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('build', ['static', 'markup', 'styles', 'scripts']);
|
||||
gulp.task('build', 'Build site into ./build directory.', ['static', 'markup', 'styles', 'scripts']);
|
||||
|
||||
gulp.task('static', function() {
|
||||
gulp.task('static', 'Build static files into ./build directory.', function() {
|
||||
return gulp.src(config.globs.other, { base: './src' })
|
||||
.pipe(gulp.dest(config.buildRoot));
|
||||
});
|
||||
|
||||
gulp.task('markup', ['markup:svg_styles'], function() {
|
||||
gulp.task('markup', 'Build markup into ./build directory.', ['markup:svg_styles'], function() {
|
||||
return gulp.src(config.globs.templates)
|
||||
.pipe(frontMatter())
|
||||
.pipe(hb({
|
||||
@ -85,7 +85,7 @@ gulp.task('markup', ['markup:svg_styles'], function() {
|
||||
.pipe(gulp.dest(config.buildRoot));
|
||||
});
|
||||
|
||||
gulp.task('markup:svg_styles', function() {
|
||||
gulp.task('markup:svg_styles', false, function() {
|
||||
return gulp.src('./src/sass/svg.scss')
|
||||
.pipe(sass({
|
||||
includePaths: bourbon.includePaths
|
||||
@ -99,7 +99,7 @@ gulp.task('markup:svg_styles', function() {
|
||||
.pipe(gulp.dest('./tmp/build'))
|
||||
});
|
||||
|
||||
gulp.task('styles', function() {
|
||||
gulp.task('styles', 'Build stylesheets into ./build directory.', function() {
|
||||
return gulp.src('./src/sass/main.scss')
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(sass({
|
||||
@ -113,7 +113,7 @@ gulp.task('styles', function() {
|
||||
.pipe(gulp.dest(config.buildPath('css')))
|
||||
});
|
||||
|
||||
gulp.task('scripts', function() {
|
||||
gulp.task('scripts', 'Build scripts into ./build directory', function() {
|
||||
return browserify(config.browserify)
|
||||
.transform(canopy)
|
||||
.transform(babelify)
|
||||
@ -130,24 +130,24 @@ gulp.task('scripts', function() {
|
||||
.pipe(gulp.dest(config.buildPath('js')));
|
||||
});
|
||||
|
||||
gulp.task('verify', ['karma:single', 'lint']);
|
||||
gulp.task('verify', 'Verify (lint and run tests) scripts.', ['karma:single', 'lint']);
|
||||
|
||||
gulp.task('verify:watch', ['karma', 'lint:watch']);
|
||||
gulp.task('verify:watch', 'Auto-verify scripts.', ['karma', 'lint:watch']);
|
||||
|
||||
gulp.task('karma', function(done) {
|
||||
gulp.task('karma', 'Auto-run scripting tests.', function(done) {
|
||||
new karma.Server({
|
||||
configFile: path.join(__dirname, 'karma.conf.js')
|
||||
}, done).start();
|
||||
});
|
||||
|
||||
gulp.task('karma:single', function(done) {
|
||||
gulp.task('karma:single', 'Run scripting tests', function(done) {
|
||||
new karma.Server({
|
||||
configFile: path.join(__dirname, 'karma.conf.js'),
|
||||
singleRun: true
|
||||
}, done).start();
|
||||
});
|
||||
|
||||
gulp.task('lint', function() {
|
||||
gulp.task('lint', 'Lint scripts', function() {
|
||||
return gulp.src(config.globs.lint)
|
||||
.pipe(jscs())
|
||||
.pipe(jscs.reporter())
|
||||
@ -155,11 +155,11 @@ gulp.task('lint', function() {
|
||||
.on('error', notify.onError())
|
||||
});
|
||||
|
||||
gulp.task('lint:watch', function() {
|
||||
gulp.task('lint:watch', 'Auto-lint scripts', function() {
|
||||
gulp.watch(config.globs.lint, ['lint']);
|
||||
});
|
||||
|
||||
gulp.task('lint:fix', config.lintRoots.map(function(root) {
|
||||
gulp.task('lint:fix', 'Fix some lint errors.', config.lintRoots.map(function(root) {
|
||||
return 'lint:fix:' + root;
|
||||
}), function() {
|
||||
return gulp.src('./*.js')
|
||||
@ -168,7 +168,7 @@ gulp.task('lint:fix', config.lintRoots.map(function(root) {
|
||||
});
|
||||
|
||||
config.lintRoots.forEach(function(root) {
|
||||
gulp.task('lint:fix:' + root, function() {
|
||||
gulp.task('lint:fix:' + root, false, function() {
|
||||
return gulp.src('./' + root + '/**/*.js')
|
||||
.pipe(jscs({fix: true}))
|
||||
.pipe(gulp.dest('./' + root));
|
||||
|
@ -20,6 +20,7 @@
|
||||
"gulp-docco": "0.0.4",
|
||||
"gulp-front-matter": "^1.3.0",
|
||||
"gulp-hb": "^2.6.5",
|
||||
"gulp-help": "^1.6.1",
|
||||
"gulp-jscs": "^3.0.2",
|
||||
"gulp-notify": "^2.0.1",
|
||||
"gulp-rename": "^1.2.2",
|
||||
|
Loading…
Reference in New Issue
Block a user