blob: 45e1c18f8b6a45754156f1602902cb41d5d0945f [file] [log] [blame]
bigbiffd006b302015-03-06 18:36:03 -05001var gulp = require('gulp');
2var browserify = require('gulp-browserify');
3var rename = require('gulp-rename');
4var using = require('gulp-using');
5var concat = require('gulp-concat');
6var uglify = require('gulp-uglify');
7
8var browserifyEntryPoint = 'src/index.js';
9
10
11
12
13
14gulp.task('default', ['js:src','js:test:unit'])
15
16gulp.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
26gulp.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
37gulp.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});