Comparing version 1.0.0 to 1.1.0
@@ -20,13 +20,25 @@ 'use strict'; | ||
var _util = require('util'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function gulpPug() { | ||
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var base = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
base = typeof base !== 'undefined' ? base : {}; | ||
return _through2.default.obj(function stream(file, enc, callback) { | ||
var error = null; | ||
if (file.isBuffer()) { | ||
var contents = _pug2.default.render(file.contents.toString(), opts); | ||
file.contents = new Buffer(contents); | ||
// Prepare new file. | ||
var html = file.clone(); | ||
html.path = (0, _gulpUtil.replaceExtension)(html.path, '.html'); | ||
// Create options for pug. | ||
var opts = (0, _util._extend)({ | ||
filename: file.path | ||
}, base); | ||
// Replace contents | ||
if (html.isBuffer()) { | ||
html.contents = new Buffer(_pug2.default.render(file.contents.toString(), opts)); | ||
} else { | ||
@@ -36,7 +48,6 @@ error = new _gulpUtil.PluginError('gulp-pug', 'Unsupported file content'); | ||
file.path = (0, _gulpUtil.replaceExtension)(file.path, '.html'); | ||
callback(error, file); | ||
// Continue | ||
callback(error, html); | ||
}); | ||
}; | ||
module.exports = exports['default']; |
{ | ||
"name": "gulp-pug", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Gulp plugin for compiling Pug templates.", | ||
@@ -5,0 +5,0 @@ "main": "out/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4482
35