Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
gulp.task('browserify', function(callback){
function createBundle(b_config){
var bundler = browserify(b_config.entry, {
debug: true
});
var bundle = function(){
// Create a logger when it starts logging
bundleLogger.start(b_config.outputName);
return bundler.bundle()
.on('error', handleErrors)
.pipe(source(b_config.outputName))
.pipe(gulp.dest(b_config.dest))
.on('end', reportFinsihed);
};
if( global.isWatching ){
// console.log("Uses watchify");
bundler = watchify(bundler);
bundler.on('update', bundle);
}
bundler.transform(to5);
var reportFinsihed = function(){
bundleLogger.end(b_config.outputName);
if( bundleQueueLen ){
bundleQueueLen --;
if( bundleQueueLen === 0 ){
callback();
}
}
};
bundle();
}
var bundleQueue = config.bundleConfigs;
var bundleQueueLen = bundleQueue.length;
bundleQueue.forEach(createBundle);
});
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.