Skip to content

Instantly share code, notes, and snippets.

@clineamb
Created February 3, 2015 15:22
Show Gist options
  • Save clineamb/c6dea737fe4cdc844a18 to your computer and use it in GitHub Desktop.
Save clineamb/c6dea737fe4cdc844a18 to your computer and use it in GitHub Desktop.
browserify 8.1.x - gulp task
//** found on this thread @ this comment: https://github.com/substack/node-browserify/issues/1044#issuecomment-72384131 **/
var through2 = require('through2');
var gulp = require('gulp');
gulp.task('browserify', function() {
gulp.src('./src/index.js')
.pipe(through2.obj(function (file, enc, next){
browserify(file.path)
.transform('stripify')
.bundle(function(err, res){
// assumes file.contents is a Buffer
file.contents = res;
next(null, file);
});
}))
.pipe(gulp.dest('./build/'))
;
});
@clineamb
Copy link
Author

clineamb commented Feb 3, 2015

Source: browserify/browserify#1044 (comment)

Put this here for reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment