Skip to content

Instantly share code, notes, and snippets.

@mitchelkuijpers
Last active August 29, 2015 14:00
Show Gist options
  • Save mitchelkuijpers/11282187 to your computer and use it in GitHub Desktop.
Save mitchelkuijpers/11282187 to your computer and use it in GitHub Desktop.
function scripts(watch) {
var bundler, rebundle;
bundler = browserify('./src/client.js', {
basedir: __dirname,
debug: !production,
cache: {}, // required for watchify
packageCache: {}, // required for watchify
fullPaths: watch // required to be true only for watchify
});
if(watch) {
bundler = watchify(bundler)
}
bundler.transform(reactify);
rebundle = function() {
var stream = bundler.bundle();
stream.on('error', handleError('Browserify'));
stream = stream.pipe(source('bundle.js'));
return stream.pipe(gulp.dest('./assets/js'));
};
bundler.on('update', rebundle);
return rebundle();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment