Skip to content

Instantly share code, notes, and snippets.

@Jeromche Jeromche/watchify.js
Last active Aug 29, 2015

What would you like to do?
Browserify/Watchify Gulp task with Underscorify and error logging with Gulp Util
var gulp = require('gulp');
var browserify = require('browserify');
var watchify = require('watchify');
var underscorify = require('node-underscorify');
var source = require('vinyl-source-stream');
var gutil = require('gulp-util');
* Writes a Browserify or Watchify bundle to file.
var write = function(bundler) {
var path = './dist/js';
var filename = 'app.js';
.on('error', function(message) {
gulp.task('watchify', function() {
var options = watchify.args;
// Set options for Watchify.
options.debug = true;
options.ignoreMissing = true;
// Create Browserify instance.
var bundler = browserify(options);
// Wrap Browserify instance in a Watcherify instance.
bundler = watchify(bundler)
.on('update', function() {
// Write has to be called once before it starts to emit `update` events.
// Run a watch to keep the process alive for now. This is just here to keep the process going.
// @todo Call the Watchify task as a dependency from another watch task and remove this.'./dist/js/**/*.js', function() {
console.log('dist updated');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.