forked from marcello3d/gulp-watchify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
41 lines (30 loc) · 962 Bytes
/
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
var gulp = require('gulp')
var watchify = require('../..')
var uglify = require('gulp-uglify')
var streamify = require('gulp-streamify')
var bundlePaths = {
src: [
'client/js/**/*.js',
"!client/js/**/lib/**" // Don't bundle libs
],
dest:'build/js/'
}
// Hack to enable configurable watchify watching
var watching = false
gulp.task('enable-watch-mode', function() { watching = true })
// Browserify and copy js files
gulp.task('browserify', watchify(function(watchify) {
return gulp.src(bundlePaths.src)
.pipe(watchify({
watch:watching
}))
.pipe(streamify(uglify()))
.pipe(gulp.dest(bundlePaths.dest))
}))
gulp.task('watchify', ['enable-watch-mode', 'browserify'])
// Rerun tasks when a file changes
gulp.task('watch', ['watchify'], function () {
// ... other watch code ...
})
// The default task (called when you run `gulp` from cli)
gulp.task('default', ['browserify'])