-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
78 lines (60 loc) · 1.75 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var $ = require('gulp-load-plugins')();
var path = {
SCSS_SRC : './scss/**/*.scss',
SCSS_DST : './css',
CSS_JKDST : './docs/css',
HTML_SRC : ['./*.html','./_posts/*.*','./_layouts/*.*', './_includes/*.*'],
}
gulp.task('scss', function () {
gulp.src( path.SCSS_SRC )
.pipe($.sourcemaps.init())
.pipe($.sass())
.pipe($.autoprefixer({ browsers: ['last 2 versions'], cascade: false }))
.pipe($.size({ showFiles: true }))
// minify scss
.pipe($.csso())
.pipe($.size({ showFiles: true }))
.pipe($.sourcemaps.write('map'))
.pipe(gulp.dest( path.SCSS_DST ))
.pipe(gulp.dest( path.CSS_JKDST ))
.pipe(browserSync.stream({ match: '**/*.css' }))
;
});
// jekyll build
gulp.task('jekyll', function () {
require('child_process').exec('bundle exec jekyll build --baseurl=', {stdio: 'inherit'}, function(){
browserSync.reload();
});
});
// jekyll serve
gulp.task('serve', function() {
//browserSync.init({
//proxy: {
//target: "http://127.0.0.1:4000/"
//}
//});
//browserSync.init({
//server: {
//baseDir: "./docs/"
//}
//});
gulp.watch(path.SCSS_SRC, ['scss', 'jekyll']);
// gulp.watch(path.SCSS_SRC, ['scss']);
//gulp.watch(path.HTML_SRC, ['jekyll']);
gulp.watch(path.HTML_SRC).on('change', browserSync.reload);
});
gulp.task('default', ['scss','jekyll','serve']);
// SCSS + build
gulp.task('build', function () {
require('child_process').exec('bundle exec jekyll build', {stdio: 'inherit'}, function(){
browserSync.reload();
});
});
// gulp.task('serveNew', function () {
// require('child_process').exec('bundle exec jekyll serve', {stdio: 'inherit'}, function(){
// browserSync.reload();
// });
// });
gulp.task('defaultGit', ['scss','build']);