Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var gulp = require('gulp');
var source = require('vinyl-source-stream'); // Used to stream bundle for further handling
var browserify = require('browserify');
var watchify = require('watchify');
var reactify = require('reactify');
var concat = require('gulp-concat');
gulp.task('browserify', function() {
var bundler = browserify({
entries: ['./public/js/render.jsx'], // Only need initial file, browserify finds the deps
transform: [reactify], // We want to convert JSX to normal javascript
debug: true, // Gives us sourcemapping
cache: {}, packageCache: {}, fullPaths: true // Requirement of watchify
var watcher = watchify(bundler);
return watcher
.on('update', function () { // When any files update
var updateStart =;
watcher.bundle() // Create new bundle that uses the cache for high performance
// This is where you add uglifying etc.
console.log('Updated!', ( - updateStart) + 'ms');
.bundle() // Create the initial bundle when starting the task
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.