gulp-browser/ts/modulebrowserify.ts

19 lines
744 B
TypeScript
Raw Permalink Normal View History

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() {
2015-10-24 18:55:14 +00:00
return through.obj((file, enc, cb) => { //this is the trough object that gets returned by gulpBrowser.browserify();
2015-10-26 22:27:33 +00:00
var bundleCallback = function(err, bufferedContent) {
if (Buffer.isBuffer(bufferedContent)){
file.contents = bufferedContent;
} else {
pr.beautylog.error("gulp-browser: .browserify() " + err.message);
}
2015-10-26 22:27:33 +00:00
cb(null,file);
2015-10-24 18:55:14 +00:00
};
2015-10-26 22:27:33 +00:00
browserify(file)
.bundle(bundleCallback)
2015-10-24 16:26:41 +00:00
});
};
}
}