
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
ejs plugin for gulp
First, install gulp-ejs
as a development dependency:
npm install --save-dev gulp-ejs
Then, add it to your gulpfile.js
:
var ejs = require("gulp-ejs")
gulp.src("./templates/*.ejs")
.pipe(ejs({
msg: "Hello Gulp!"
}))
.pipe(gulp.dest("./dist"))
If you want to use gulp-ejs
in a watch/livereload task, you may want to avoid gulp exiting on error when, for instance, a partial file is ENOENT
.
Here's an example on how to make it work:
var ejs = require('gulp-ejs')
var log = require('fancy-log')
gulp.src('./templates/*.ejs')
.pipe(ejs({
msg: 'Hello Gulp!'
}).on('error', log))
.pipe(gulp.dest('./dist'))
This will make gulp log the error and continue normal execution.
If you want to specify the extension of output files, set the ext option:
var ejs = require('gulp-ejs')
gulp.src('./templates/*.ejs')
.pipe(ejs({ msg: 'Hello Gulp!'}, {}, { ext: '.html' }))
.pipe(gulp.dest('./dist'))
The ejs object is also exported and you can use it to configure ejs:
var gulpEjs = require('gulp-ejs')
gulpEjs.ejs.fileLoader = function () { /* custom file loader */ }
Type: hash
Default: {}
A hash object where each key corresponds to a variable in your template.
Note: As of v1.2.0
, file.data
is supported as a way of passing data into ejs. See this. If both file.data
and data
are passed, they are merged (data
works as default for ejs options and file.data
overrides it.)
Type: hash
Default: {}
A hash object for ejs options.
For more info on ejs
options, check the project's documentation.
Type: hash
Default: {}
A hash object to configure the plugin.
Type: String
Default: undefined
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.
FAQs
A plugin for Gulp that parses ejs template files
We found that gulp-ejs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.