Skip to content

Instantly share code, notes, and snippets.

@akbr
Last active July 8, 2016 10:48
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save akbr/10663723 to your computer and use it in GitHub Desktop.
Save akbr/10663723 to your computer and use it in GitHub Desktop.
gulp + browserify
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