136
rated 0 times
[
137]
[
1]
/ answers: 1 / hits: 17202
/ 10 Years ago, fri, may 23, 2014, 12:00:00
I have browserify bundling up files and it's working great. But what if I need to generate multiple bundles?
I would like to end up with dist/appBundle.js
and dist/publicBundle.js
gulp.task(js, function(){
return browserify([
./js/app.js,
./js/public.js
])
.bundle()
.pipe(source(bundle.js))
.pipe(gulp.dest(./dist));
});
Obviously this isn't going to work since I am only specifying one output (bundle.js). I can accomplish this by repeating the above statement like so (but it doesn't feel right, because of the repetition):
gulp.task(js, function(){
browserify([
./js/app.js
])
.bundle()
.pipe(source(appBundle.js))
.pipe(gulp.dest(./dist));
browserify([
./js/public.js
])
.bundle()
.pipe(source(publicBundle.js))
.pipe(gulp.dest(./dist));
});
Is there a better way to tackle this? Thanks!
More From » node.js