Skip to content

Instantly share code, notes, and snippets.

@monjer
Created April 25, 2017 10:25
Show Gist options
  • Select an option

  • Save monjer/085ee06f22d0cf5cf9998bd5aaa8040f to your computer and use it in GitHub Desktop.

Select an option

Save monjer/085ee06f22d0cf5cf9998bd5aaa8040f to your computer and use it in GitHub Desktop.
var gulp = require('gulp'),
source = require('vinyl-source-stream'),
rename = require('gulp-rename'),
browserify = require('browserify'),
es = require('event-stream');
gulp.task('default', function() {
// set entry files
var files = [
'./app/entry-a.js',
'./app/entry-b.js'
];
// map them to streams
var tasks = files.map(function(entry) {
return browserify({ entries: [entry] })
.bundle()
.pipe(source(entry))
.pipe(rename({
extname: '.bundle.js'
}))
.pipe(gulp.dest('./dist'));
});
// merge
return es.merge.apply(null, tasks);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment