Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using watchify with gulp
'use strict';
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var notifier = require('stream-notifier');
var watchify = require('watchify');
gulp.task('browserify', function() {
var bundler = browserify('./src/main')
var bundle = compileBundle(bundler);
return bundle();
gulp.task('watchify', function() {
var opts = watchify.args;
opts.debug = true;
var bundler = watchify(browserify('./src/main', opts));
var bundle = compileBundle(bundler)
bundler.on('update', bundle);
return bundle();
function compileBundle(bundler) {
return function() {
var n = notifier('browserify');
return bundler
.on('error', n.error)
.on('end', n.end);
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.