-
Notifications
You must be signed in to change notification settings - Fork 16
/
gulpfile.js
58 lines (43 loc) · 1.32 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
const exec = require('child_process').exec;
const { series, parallel, watch } = require('gulp');
const browserSync = require('browser-sync');
const server = browserSync.create();
// PRIVATE TASKS
//
function serve(cb) {
server.init({
ui: false,
server: {
baseDir: './',
routes: {
'/': 'docs'
}
},
ghostMode: false,
online: false,
open: "local"
});
cb();
}
function reload(cb) {
server.reload();
cb();
}
function compileSass() { return exec('npm run sass'); }
function compileJs() { return exec('npm run js'); }
function compileHtml() { return exec('npm run html'); }
// WATCHERS
//
// Watch all relevant files and assign tasks to be
// completed in a series when any of them change.
watch('./_content/**/*.{md,html}', series(compileHtml, reload));
watch('./_site/templates/**/*.njk', series(compileHtml, reload));
watch('./_site/includes/scss/**/*.scss', series(compileSass, compileHtml, reload));
watch('./_site/includes/js/**/*.js', series(compileJs, compileHtml, reload));
// PUBLIC TASKS
//
// When the following task is run: compile sass, js and html concurrently,
// then start the server, open the browser and watch all relevant files.
exports.serve = serve;
exports.watch = series(parallel(compileSass, compileJs, compileHtml), serve);
exports.default = exports.watch;