2015-10-24 18:55:14 +00:00
|
|
|
/// <reference path="./index.ts" />
|
2015-10-24 16:26:41 +00:00
|
|
|
module GulpBrowserBrowserify {
|
|
|
|
export function init() {
|
|
|
|
return function() {
|
2016-01-24 23:42:11 +00:00
|
|
|
return plugins.through.obj((file, enc, cb) => { //this is the through object that gets returned by gulpBrowser.browserify();
|
2015-10-26 22:27:33 +00:00
|
|
|
var bundleCallback = function(err, bufferedContent) {
|
2015-12-05 21:29:06 +00:00
|
|
|
if (Buffer.isBuffer(bufferedContent)){
|
|
|
|
file.contents = bufferedContent;
|
|
|
|
} else {
|
2016-01-24 23:42:11 +00:00
|
|
|
plugins.beautylog.error("gulp-browser: .browserify() " + err.message);
|
2015-12-05 21:29:06 +00:00
|
|
|
}
|
2015-10-26 22:27:33 +00:00
|
|
|
cb(null,file);
|
2015-10-24 18:55:14 +00:00
|
|
|
};
|
2016-01-31 23:07:53 +00:00
|
|
|
plugins.browserify(file, { basedir: file.base })
|
2015-10-26 22:27:33 +00:00
|
|
|
.bundle(bundleCallback)
|
2015-10-24 16:26:41 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|