-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
39 lines (30 loc) · 930 Bytes
/
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
// initiating requires
var gulp = require('gulp');
var child = require('child_process');
var gutil = require('gulp-util')
var browserSync = require('browser-sync').create();
// gulp.task('build', shell.task(['jekyll serve -w']));
// task for auto refresh with browser-sync
gulp.task('serve', () => {
browserSync.init({
server: {
baseDir: '_site/'
},
notify: false,
reloadDebounce: 500
});
gulp.watch('_site/**/*.*')
.on('change', browserSync.reload)
});
// task for running jekyll shell commands
gulp.task('build', ['serve'],() => {
const jekyll = child.spawn('jekyll', ['serve', '--watch']);
const jekyllLogger = (buffer) => {
buffer.toString()
.split(/\n/)
.forEach((message) => gutil.log('Jekyll: ' + message))
};
jekyll.stdout.on('data', jekyllLogger);
jekyll.stderr.on('data', jekyllLogger);
});
gulp.task('default', ['build']);