forked from KeJunMao/jekyll-theme-mdui
-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.js
51 lines (43 loc) · 1.14 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
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 siteRoot = '_site';
gulp.task('jekyll', () => {
const jekyll = child.exec('bundle exec jekyll b -w');
const jekyllLogger = (buffer) => {
buffer = buffer.toString();
buffer = buffer.split(/\n/)
buffer.forEach(function(message){
if (message!=""){
gutil.log('Jekyll: ' + message)
}
})
};
jekyll.stdout.on('data', jekyllLogger);
jekyll.stderr.on('data', jekyllLogger);
});
gulp.task('serve', () => {
browserSync.init({
files: [siteRoot + '/**'],
port: 4000,
server: {
baseDir: siteRoot
}
});
});
gulp.task('docs',() =>{
const docs = child.exec('docsify serve docs');
const docsifyLog = (buffer) => {
buffer = buffer.toString();
buffer = buffer.split(/\n/)
buffer.forEach(function(message){
if (message!=""){
gutil.log('Docsify: ' + message)
}
});
}
docs.stdout.on('data', docsifyLog);
})
gulp.task('default', ['jekyll', 'serve', 'docs']);