Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-ejs

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-ejs - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

7

index.js

@@ -7,7 +7,10 @@ 'use strict';

module.exports = function (options) {
module.exports = function (options, settings) {
return es.map(function (file, cb) {
try {
settings = settings || {};
if(!settings.ext) settings.ext = '.html';
file.contents = new Buffer(ejs.render(file.contents.toString(), options));
file.path = gutil.replaceExtension(file.path, '.html');
file.path = gutil.replaceExtension(file.path, settings.ext);
cb(null, file);

@@ -14,0 +17,0 @@ } catch (err) {

{
"name": "gulp-ejs",
"version": "0.1.2",
"version": "0.1.3",
"description": "A plugin for Gulp that parses ejs template files",

@@ -5,0 +5,0 @@ "keywords": [

@@ -27,3 +27,3 @@ # gulp-ejs [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url]

### ejs(options)
### ejs(options, settings)

@@ -38,3 +38,15 @@ #### options

#### settings
Type: `hash`
Default: `{ext: '.html'}`
A hash object to configure the plugin.
##### settings.ext
Type: `String`
Default: `.html`
Defines the default file extension that will be appended to the filename.
## License

@@ -41,0 +53,0 @@

@@ -5,3 +5,4 @@ /*global describe, it*/

var fs = require('fs'),
should = require('should');
should = require('should'),
path = require('path');
require('mocha');

@@ -47,3 +48,5 @@

stream.write(srcFile);
stream.end();
String(path.extname(srcFile.path)).should.equal('.html');
stream.end();
});

@@ -70,2 +73,33 @@

});
it('should produce correct html output with a specific file extension', function (done) {
var srcFile = new gutil.File({
path: 'test/fixtures/ok.ejs',
cwd: 'test/',
base: 'test/fixtures',
contents: fs.readFileSync('test/fixtures/ok.ejs')
});
var stream = ejs({ title: 'gulp-ejs' }, {ext:'.txt'});
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('.txt');
stream.end();
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc