forked from GovLab/ogrx-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
59 lines (49 loc) · 1.29 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
var gulp = require('gulp'),
shell = require('gulp-shell'),
ghPages = require('gulp-gh-pages'),
imagemin = require('gulp-imagemin'),
browserSync = require('browser-sync'),
cp = require('child_process'),
runSequence = require('run-sequence').use(gulp);
var messages = {
jekyllBuild: 'building...'
};
// Browser Sync
gulp.task('browserSync', function () {
browserSync({
server: {
baseDir: '_site'
}
});
});
gulp.task('image', function () {
return gulp.src('source/images/**/*')
.pipe(imagemin())
.pipe(gulp.dest('_site/images'));
});
gulp.task('push-gh-master', shell.task(['git push origin master']));
gulp.task('push-gh-pages', function () {
return gulp.src('_site/**/*')
.pipe(ghPages({ force: true }));
});
gulp.task('deploy', function (callback) {
runSequence(
'image',
'push-gh-master',
'push-gh-pages',
callback
);
});
gulp.task('jekyll', shell.task(['jekyll build --incremental']));
gulp.task('jekyll-rebuild', ['jekyll'], function () {
browserSync.reload();
});
gulp.task('watch', function () {
gulp.watch('source/**/*.*', ['jekyll-rebuild']);
});
gulp.task('default', function (callback) {
runSequence(
['watch', 'browserSync'],
callback
);
});