Comparing version 1.2.2 to 2.0.0
@@ -8,5 +8,4 @@ 'use strict'; | ||
module.exports = function (options, settings) { | ||
options = options || {}; | ||
settings = settings || {}; | ||
options = options || {}; | ||
settings.ext = typeof settings.ext === "undefined" ? ".html" : settings.ext; | ||
@@ -33,3 +32,6 @@ return through.obj(function (file, enc, cb) { | ||
); | ||
file.path = gutil.replaceExtension(file.path, settings.ext); | ||
if (typeof settings.ext !== 'undefined') { | ||
file.path = gutil.replaceExtension(file.path, settings.ext); | ||
} | ||
} catch (err) { | ||
@@ -36,0 +38,0 @@ this.emit('error', new gutil.PluginError('gulp-ejs', err.toString())); |
{ | ||
"name": "gulp-ejs", | ||
"version": "1.2.2", | ||
"version": "2.0.0", | ||
"description": "A plugin for Gulp that parses ejs template files", | ||
@@ -32,3 +32,3 @@ "keywords": [ | ||
"mocha": "2.3.4", | ||
"should": "8.0.0" | ||
"should": "8.1.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "engines": { |
@@ -55,3 +55,3 @@ # gulp-ejs [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url] | ||
Type: `hash` | ||
Default: `{ext: '.html'}` | ||
Default: `{}` | ||
@@ -62,7 +62,9 @@ A hash object to configure the plugin. | ||
Type: `String` | ||
Default: `.html` | ||
Default: `undefined` | ||
Defines the default file extension that will be appended to the filename. | ||
Defines the file extension that will be appended to the filename. If no extension is provided, the same extension of the input file will be used. | ||
**Note:** As of `v2.0.0` the output file extension is no longer `.html` by default, you need to specify it, otherwise it will have the same extension of the input file. | ||
## License | ||
@@ -69,0 +71,0 @@ |
@@ -54,3 +54,3 @@ /*global describe, it*/ | ||
stream.write(srcFile); | ||
String(path.extname(srcFile.path)).should.equal('.html'); | ||
String(path.extname(srcFile.path)).should.equal('.ejs'); | ||
@@ -138,9 +138,9 @@ stream.end(); | ||
var file1 = new gutil.File({ | ||
path: 'foo', | ||
contents: new Buffer('<%- filename -%>.html') | ||
path: 'foo.html', | ||
contents: new Buffer('<%- filename -%>') | ||
}); | ||
var file2 = new gutil.File({ | ||
path: 'bar', | ||
contents: new Buffer('<%- filename -%>.html') | ||
path: 'bar.html', | ||
contents: new Buffer('<%- filename -%>') | ||
}); | ||
@@ -151,5 +151,7 @@ | ||
stream.on('data', function (newFile) { | ||
newFile.contents.toString().should.equal(newFile.path); | ||
newFile.contents.toString().should.equal(newFile.path); | ||
if (newFile.path == 'bar.html') done(); | ||
if (newFile.path == 'bar.html') { | ||
done(); | ||
} | ||
}); | ||
@@ -189,3 +191,3 @@ | ||
stream.write(srcFile); | ||
String(path.extname(srcFile.path)).should.equal('.html'); | ||
String(path.extname(srcFile.path)).should.equal('.ejs'); | ||
@@ -192,0 +194,0 @@ stream.end(); |
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
14507
237
80