bigbiff | d006b30 | 2015-03-06 18:36:03 -0500 | [diff] [blame] | 1 | var gulp = require('gulp'); |
| 2 | var browserify = require('gulp-browserify'); |
| 3 | var rename = require('gulp-rename'); |
| 4 | var using = require('gulp-using'); |
| 5 | var concat = require('gulp-concat'); |
| 6 | var uglify = require('gulp-uglify'); |
| 7 | |
| 8 | var browserifyEntryPoint = 'src/index.js'; |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | gulp.task('default', ['js:src','js:test:unit']) |
| 15 | |
| 16 | gulp.task('watch',['default'], function(){ |
| 17 | gulp.watch(['!'+browserifyEntryPoint,'src/**/*.js'], ['js:src','js:test:unit']); |
| 18 | gulp.watch(['!test/unit/browserifiedTests.js','test/unit/**/*Test.js'], ['js:test:unit']); |
| 19 | }); |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | gulp.task('js:src', function() { |
| 27 | gulp.src(browserifyEntryPoint) |
| 28 | .pipe(browserify({ |
| 29 | // insertGlobals : true, |
| 30 | debug : !process.env.PROD |
| 31 | })) |
| 32 | .pipe(uglify({mangle: false,compress:true})) |
| 33 | .pipe(rename('jekyll-search.js')) |
| 34 | .pipe(gulp.dest('./dest/')) |
| 35 | }); |
| 36 | |
| 37 | gulp.task('js:test:unit', function() { |
| 38 | gulp.src(['test/unit/**/*Test.js']) |
| 39 | .pipe(using()) |
| 40 | .pipe(concat('browserifiedTests.js')) |
| 41 | .pipe(browserify({ |
| 42 | // insertGlobals : true, |
| 43 | debug : !process.env.PROD |
| 44 | })) |
| 45 | .pipe(using()) |
| 46 | .pipe(gulp.dest('./test/unit/')) |
| 47 | }); |