forked from TeamWin/twrpme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
48 lines (40 loc) · 1.17 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
var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
var minifyCSS = require('gulp-minify-css');
var notify = require('gulp-notify');
var gutil = require('gulp-util');
var cp = require('child_process');
var path = require('path');
var uglify = require('gulp-uglify');
var jsonminify = require('gulp-jsonminify');
var messages = {
jekyllBuild: '<span style="color: grey">Running:</span> $ jekyll build'
};
/**
* Build the Jekyll Site
*/
gulp.task('jekyll-build', function (done) {
browserSync.notify(messages.jekyllBuild);
return cp.spawn('jekyll', ['build'], {stdio: 'inherit'})
.on('close', done);
});
// minifiy js
gulp.task('js', function() {
gulp.src('_site/js/*.js')
.pipe(uglify())
.pipe(gulp.dest('dist/js/'))
});
gulp.task('json', function() {
gulp.src('_site/*.json')
.pipe(jsonminify())
.pipe(gulp.dest('dist/'))
});
gulp.task('cp1', function() {
gulp.src('dist/js/*.js')
.pipe(gulp.dest('_site/js/'))
});
gulp.task('cp2', function() {
gulp.src('dist/search.json')
.pipe(gulp.dest('_site/'))
});
gulp.task('default', ['js', 'json', 'cp1', 'cp2']);