Comparing version 1.2.1 to 1.2.2
@@ -25,6 +25,8 @@ 'use strict'; | ||
options = file.data || options; | ||
options.filename = file.path; | ||
try { | ||
file.contents = new Buffer( | ||
ejs.render(file.contents.toString(), file.data || options) | ||
ejs.render(file.contents.toString(), options) | ||
); | ||
@@ -31,0 +33,0 @@ file.path = gutil.replaceExtension(file.path, settings.ext); |
{ | ||
"name": "gulp-ejs", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "A plugin for Gulp that parses ejs template files", | ||
@@ -27,8 +27,8 @@ "keywords": [ | ||
"ejs": "2.3.4", | ||
"gulp-util": "3.0.6", | ||
"gulp-util": "3.0.7", | ||
"through2": "2.0.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "2.3.3", | ||
"should": "7.1.0" | ||
"mocha": "2.3.4", | ||
"should": "8.0.0" | ||
}, | ||
@@ -35,0 +35,0 @@ "engines": { |
@@ -159,2 +159,34 @@ /*global describe, it*/ | ||
it('should support passing data with gulp-data', function (done) { | ||
var srcFile = new gutil.File({ path: 'test/fixtures/ok.ejs', | ||
cwd: 'test/', | ||
base: 'test/fixtures', | ||
contents: fs.readFileSync('test/fixtures/ok.ejs') | ||
}); | ||
// simulate gulp-data plugin | ||
srcFile.data = { title: 'gulp-ejs' }; | ||
var stream = ejs(); | ||
stream.on('error', function (err) { | ||
should.exist(err); | ||
done(err); | ||
}); | ||
stream.on('data', function (newFile) { | ||
should.exist(newFile); | ||
should.exist(newFile.contents); | ||
String(newFile.contents).should.equal(String(expectedFile.contents)); | ||
done(); | ||
}); | ||
stream.write(srcFile); | ||
String(path.extname(srcFile.path)).should.equal('.html'); | ||
stream.end(); | ||
}); | ||
describe('with assets', function () { | ||
@@ -221,35 +253,3 @@ it('should templating with javascripts', function (done) { | ||
}); | ||
it('should support passing data with gulp-data', function (done) { | ||
var srcFile = new gutil.File({ path: 'test/fixtures/ok.ejs', | ||
cwd: 'test/', | ||
base: 'test/fixtures', | ||
contents: fs.readFileSync('test/fixtures/ok.ejs') | ||
}); | ||
// simulate gulp-data plugin | ||
srcFile.data = { title: 'gulp-ejs' }; | ||
var stream = ejs(); | ||
stream.on('error', function (err) { | ||
should.exist(err); | ||
done(err); | ||
}); | ||
stream.on('data', function (newFile) { | ||
should.exist(newFile); | ||
should.exist(newFile.contents); | ||
String(newFile.contents).should.equal(String(expectedFile.contents)); | ||
done(); | ||
}); | ||
stream.write(srcFile); | ||
String(path.extname(srcFile.path)).should.equal('.html'); | ||
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
14262
234
+ Addedansi-gray@0.1.1(transitive)
+ Addedansi-wrap@0.1.0(transitive)
+ Addedcolor-support@1.1.3(transitive)
+ Addedfancy-log@1.3.3(transitive)
+ Addedglogg@1.0.2(transitive)
+ Addedgulp-util@3.0.7(transitive)
+ Addedgulplog@1.0.0(transitive)
+ Addedhas-gulplog@0.1.0(transitive)
+ Addedparse-node-version@1.0.1(transitive)
+ Addedsparkles@1.0.1(transitive)
+ Addedtime-stamp@1.1.0(transitive)
- Removedgulp-util@3.0.6(transitive)
Updatedgulp-util@3.0.7