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();
|
|
|
|
var content = String(file.contents); // get the content of the file
|
|
|
|
var bundleCallback = (err,bundledBuffer) => { //gets called by browserify, arrow function (TS) preserves this
|
|
|
|
file.contents = bundledBuffer;
|
|
|
|
this.push(file);
|
|
|
|
cb();
|
|
|
|
};
|
|
|
|
browserify(content).bundle(bundleCallback);
|
2015-10-24 16:26:41 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|