-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathgulpfile.js
59 lines (50 loc) · 1.4 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
'use strict';
const drizzle = require('drizzle-builder');
const gulp = require('gulp');
const ghPages = require('gulp-gh-pages');
const helpers = require('@cloudfour/hbs-helpers');
const tasks = require('@cloudfour/gulp-tasks');
const env = require('gulp-util').env;
const config = require('./config');
// Append config
Object.assign(config.drizzle, { helpers });
// Register core tasks
['clean', 'copy', 'js', 'serve', 'watch'].forEach(name =>
tasks[name](gulp, config[name])
);
// Register special CSS tasks
tasks.css(gulp, config['css:toolkit']);
tasks.css(gulp, config['css:drizzle']);
gulp.task('css', ['css:drizzle', 'css:toolkit']);
// Register Drizzle builder task
gulp.task('drizzle', () => {
const result = drizzle(config.drizzle);
return result;
});
// Register frontend composite task
gulp.task('frontend', ['drizzle', 'copy', 'css', 'js']);
// Register build task (for continuous deployment via Netflify)
gulp.task('build', ['clean'], done => {
gulp.start('frontend');
done();
});
/**
* Register demo task (deploy output to GitHub Pages)
* NOTE: Run this after building.
*/
gulp.task('demo', () => {
const buildDest = `${config.drizzle.dest.pages}/**/*`;
return gulp.src(buildDest).pipe(
ghPages({
cacheDir: 'demo'
})
);
});
// Register default task
gulp.task('default', ['frontend'], done => {
gulp.start('serve');
if (env.dev) {
gulp.start('watch');
}
done();
});