gulp-eslit
Version:
ES6 Template Strings + Promises
35 lines (28 loc) • 985 B
JavaScript
;
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var path = _interopDefault(require('path'));
var eslit = _interopDefault(require('eslit'));
var gulpUtil = require('gulp-util');
var through2 = require('through2');
// internal tooling
// external tooling
// gulp eslit
var index = (function (data, opts) {
return through2.obj(function (file, enc, cb) {
if (file.isStream()) {
throw new gulpUtil.PluginError('gulp-eslit', 'Streaming not supported');
} else if (file.isNull()) {
return cb(null, file);
}
return eslit.parse(file.contents.toString(enc), Object.assign({}, data), Object.assign({
cwd: path.dirname(file.path)
}, opts)).then(function (content) {
file.contents = new Buffer(content);
return cb(null, file);
}, function (error) {
throw new gulpUtil.PluginError('gulp-eslit', error);
});
});
});
module.exports = index;
//# sourceMappingURL=index.dist.js.map