Skip to content

Instantly share code, notes, and snippets.

@zapaiamarce
Last active August 29, 2015 14:21
Show Gist options
  • Save zapaiamarce/52e71d3f180fd5cd0c34 to your computer and use it in GitHub Desktop.
Save zapaiamarce/52e71d3f180fd5cd0c34 to your computer and use it in GitHub Desktop.
Gulp — Browserify — Watch — Glob
var gulp = require('gulp');
var watchify = require('watchify');
var glob = require('glob');
var browserify = require('browserify');
gulp.task('js', function(){
glob('./scripts/*.js', function(err, files) {
files.forEach(function(entry) {
var w = watchify(browserify({ entries: [entry] }))
var build = function(){
w.bundle()
.pipe(source(entry))
.pipe(gulp.dest('./public/js/'));
}
w.on('update',build)
build();
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment