bigbiff bigbiff | eb40950 | 2016-12-10 13:13:16 -0500 | [diff] [blame] | 1 | var gulp = require('gulp'); |
| 2 | var autoprefixer = require('gulp-autoprefixer'); |
| 3 | var minifyCSS = require('gulp-minify-css'); |
| 4 | var notify = require('gulp-notify'); |
| 5 | var gutil = require('gulp-util'); |
| 6 | var cp = require('child_process'); |
| 7 | var path = require('path'); |
| 8 | var uglify = require('gulp-uglify'); |
| 9 | var jsonminify = require('gulp-jsonminify'); |
bigbiff | d006b30 | 2015-03-06 18:36:03 -0500 | [diff] [blame] | 10 | |
| 11 | |
bigbiff bigbiff | eb40950 | 2016-12-10 13:13:16 -0500 | [diff] [blame] | 12 | var messages = { |
| 13 | jekyllBuild: '<span style="color: grey">Running:</span> $ jekyll build' |
| 14 | }; |
bigbiff | d006b30 | 2015-03-06 18:36:03 -0500 | [diff] [blame] | 15 | |
bigbiff bigbiff | eb40950 | 2016-12-10 13:13:16 -0500 | [diff] [blame] | 16 | /** |
| 17 | * Build the Jekyll Site |
| 18 | */ |
| 19 | gulp.task('jekyll-build', function (done) { |
| 20 | browserSync.notify(messages.jekyllBuild); |
| 21 | return cp.spawn('jekyll', ['build'], {stdio: 'inherit'}) |
| 22 | .on('close', done); |
bigbiff | d006b30 | 2015-03-06 18:36:03 -0500 | [diff] [blame] | 23 | }); |
| 24 | |
bigbiff bigbiff | eb40950 | 2016-12-10 13:13:16 -0500 | [diff] [blame] | 25 | // minifiy js |
| 26 | gulp.task('js', function() { |
| 27 | gulp.src('_site/js/*.js') |
| 28 | .pipe(uglify()) |
| 29 | .pipe(gulp.dest('dist/js/')) |
bigbiff | d006b30 | 2015-03-06 18:36:03 -0500 | [diff] [blame] | 30 | }); |
| 31 | |
bigbiff bigbiff | eb40950 | 2016-12-10 13:13:16 -0500 | [diff] [blame] | 32 | gulp.task('json', function() { |
| 33 | gulp.src('_site/*.json') |
| 34 | .pipe(jsonminify()) |
| 35 | .pipe(gulp.dest('dist/')) |
bigbiff | d006b30 | 2015-03-06 18:36:03 -0500 | [diff] [blame] | 36 | }); |
bigbiff bigbiff | eb40950 | 2016-12-10 13:13:16 -0500 | [diff] [blame] | 37 | |
| 38 | gulp.task('cp1', function() { |
| 39 | gulp.src('dist/js/*.js') |
| 40 | .pipe(gulp.dest('_site/js/')) |
| 41 | }); |
| 42 | |
| 43 | gulp.task('cp2', function() { |
| 44 | gulp.src('dist/search.json') |
| 45 | .pipe(gulp.dest('_site/')) |
| 46 | }); |
| 47 | |
| 48 | gulp.task('default', ['js', 'json', 'cp1', 'cp2']); |