Skip to content

Instantly share code, notes, and snippets.

@tonypizzicato
Created September 9, 2015 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonypizzicato/98f989d7acd64bfaa654 to your computer and use it in GitHub Desktop.
Save tonypizzicato/98f989d7acd64bfaa654 to your computer and use it in GitHub Desktop.
gulp browserify with update time
gulp.task('browserify', function () {
var bundler = browserify({
entries: [path.JS_MAIN],
transform: [[babelify]],
debug: true,
cache: {},
packageCache: {},
fullPaths: true
});
var watcher = watchify(bundler);
watcher.on('time', function (time) {
util.log(util.colors.green('Browserify'), util.colors.blue('in ' + time / 1000 + 's'));
});
return watcher
.on('update', function () {
watcher.bundle()
.on('error', function (error) {
console.log(error.message);
})
.pipe(source(path.OUT))
.pipe(gulp.dest(path.TMP));
util.log(util.colors.green('Browserify'), util.colors.yellow('updating'));
})
.bundle()
.pipe(source(path.OUT))
.pipe(gulp.dest(path.TMP));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment