Last active
August 29, 2015 14:00
-
-
Save mitchelkuijpers/11282187 to your computer and use it in GitHub Desktop.
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
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