gulp-browser/index.js

34 lines
1.2 KiB
JavaScript
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
var GulpBrowserBrowserify;
(function (GulpBrowserBrowserify) {
function init() {
return function () {
return through.obj(function (file, enc, cb) {
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
});
};
}
GulpBrowserBrowserify.init = init;
})(GulpBrowserBrowserify || (GulpBrowserBrowserify = {}));
/// <reference path="./typings/tsd.d.ts" />
/// <reference path="./modulebrowserify.ts" />
var through = require("through2");
2015-10-26 22:27:33 +00:00
var gutil = require("gulp-util");
2015-10-24 16:26:41 +00:00
var path = require("path");
var browserify = require("browserify");
2015-10-24 18:55:14 +00:00
var pr = require("pushrocks");
2015-10-24 16:26:41 +00:00
//create the return object
var gulpBrowser = {};
gulpBrowser.browserify = GulpBrowserBrowserify.init();
module.exports = gulpBrowser;