Created
February 3, 2015 15:22
-
-
Save clineamb/c6dea737fe4cdc844a18 to your computer and use it in GitHub Desktop.
browserify 8.1.x - gulp task
This file contains 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
//** 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/')) | |
; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Source: browserify/browserify#1044 (comment)
Put this here for reference.