2016-01-24 23:42:11 +00:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2015-10-24 18:55:14 +00:00
|
|
|
/// <reference path="./index.ts" />
|
2015-10-24 16:26:41 +00:00
|
|
|
var GulpBrowserBrowserify;
|
|
|
|
(function (GulpBrowserBrowserify) {
|
|
|
|
function init() {
|
|
|
|
return function () {
|
2016-01-24 23:42:11 +00:00
|
|
|
return plugins.through.obj(function (file, enc, cb) {
|
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
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
GulpBrowserBrowserify.init = init;
|
|
|
|
})(GulpBrowserBrowserify || (GulpBrowserBrowserify = {}));
|
2016-01-31 23:04:05 +00:00
|
|
|
/// <reference path="./typings/main.d.ts" />
|
2015-10-24 16:26:41 +00:00
|
|
|
/// <reference path="./modulebrowserify.ts" />
|
2016-01-24 23:42:11 +00:00
|
|
|
var plugins = {
|
|
|
|
beautylog: require("beautylog"),
|
|
|
|
through: require("through2"),
|
|
|
|
gutil: require("gulp-util"),
|
|
|
|
path: require("path"),
|
|
|
|
browserify: require("browserify")
|
|
|
|
};
|
2015-10-24 16:26:41 +00:00
|
|
|
//create the return object
|
|
|
|
var gulpBrowser = {};
|
|
|
|
gulpBrowser.browserify = GulpBrowserBrowserify.init();
|
|
|
|
module.exports = gulpBrowser;
|