Created by: koistya
Before:
var bundler = watchify('./src/index.js')
gulp.task('browserify', rebundle)
gulp.task('watch', ['browserify'], function() {
bundler.on('update', rebundle)
})
function rebundle() {
return bundler.bundle()
.pipe(source('bundle.js'))
.pipe(gulp.dest('./dist'))
}
// Optionally, you can apply transforms
// and other configuration options on the
// bundler just as you would with browserify
bundler.transform('brfs')
After:
gulp.task('watch', function () {
var bundler = watchify('./src/index.js');
// Optionally, you can apply transforms
// and other configuration options on the
// bundler just as you would with browserify
bundler.transform('brfs')
bundler.on('update', rebundle)
function rebundle () {
return bundler.bundle()
.pipe(source('bundle.js'))
.pipe(gulp.dest('./dist'))
}
return rebundle()
})