Thanks to visit codestin.com
Credit goes to github.com

Skip to content

leolord/gulp-ejs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-ejs NPM version Build Status Dependency Status

ejs plugin for gulp

Usage

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 gutil = require('gulp-util');

gulp.src('./templates/*.ejs')
	.pipe(ejs({
		msg: 'Hello Gulp!'
	}).on('error', gutil.log))
	.pipe(gulp.dest('./dist'));

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

API

ejs(data, options)

data

Type: hash Default: {}

A hash object where each key corresponds to a variable in your template. DO NOT SET EJS OPTIONS IN THIS HASH.

options

Type: hash Default: {ext: '.html'}

A hash object to configure the plugin and ejs. You should set ejs options in this hash.

For more info on ejs options, check the project's documentation.

options.ext

Type: String Default: .html

Defines the default file extension that will be appended to the filename.

License

MIT License

About

Gulp plugin for ejs templates

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 91.2%
  • CSS 6.2%
  • HTML 2.6%