Last active
August 29, 2015 14:21
-
-
Save zapaiamarce/52e71d3f180fd5cd0c34 to your computer and use it in GitHub Desktop.
Gulp — Browserify — Watch — Glob
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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