Last active
July 8, 2016 10:48
-
-
Save akbr/10663723 to your computer and use it in GitHub Desktop.
gulp + browserify
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
var gulp = require('gulp'); | |
var browserify = require('browserify'); | |
var source = require('vinyl-source-stream'); | |
var libs = ["underscore", "jquery"]; | |
gulp.task("vendor", function () { | |
var b = browserify(); | |
libs.forEach(function (lib) { | |
b.require(lib); | |
}); | |
return b.bundle() | |
.pipe(source("vendor.js")) | |
.pipe(gulp.dest('./build/')); | |
}); | |
gulp.task("app", function () { | |
var b = browserify({entries:"./app.js"}); | |
libs.forEach(function (lib) { | |
b.external(lib); | |
}); | |
return b.bundle() | |
.pipe(source("app.js")) | |
.pipe(gulp.dest('./build/')); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment