-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
48 lines (39 loc) · 1.01 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
const child = require('child_process');
const browserSync = require('browser-sync').create();
const gulp = require('gulp');
const concat = require('gulp-concat');
const gutil = require('gulp-util');
const sass = require('gulp-sass');
const siteRoot = '_site';
const cssFiles = '_css/**/*.?(s)css';
gulp.task('css', () => {
gulp.src(cssFiles)
.pipe(sass())
.pipe(concat('all.css'))
.pipe(gulp.dest('assets'));
});
gulp.task('jekyll', () => {
const jekyll = child.spawn('jekyll', ['build',
'--watch',
'--incremental',
'--drafts'
]);
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('serve', () => {
browserSync.init({
files: [siteRoot + '/**'],
port: 3000,
server: {
baseDir: siteRoot
}
});
gulp.watch(cssFiles, ['css']);
});
gulp.task('default', ['css', 'jekyll', 'serve']);