node package manager


gulp-ejs NPM version Build Status Dependency Status

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")
        msg: "Hello Gulp!"

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 gutil = require('gulp-util')
        msg: 'Hello Gulp!'
    }).on('error', gutil.log))

This will make gulp log the error and continue normal execution.


ejs(data, options, settings)


Type: hash Default: {}

A hash object where each key corresponds to a variable in your template.

Note: As of v1.2.0, is supported as a way of passing data into ejs. See this. If both and data are passed, they are merged (data works as default for ejs options and 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.


MIT License