gulp-template

Compile Lodash templates. Underscore too.

npm install gulp-template
78 downloads in the last day
493 downloads in the last week
2 192 downloads in the last month

gulp-template Build Status

Compile Lo-Dash templates

Lo-Dash is like Underscore, but faster and better.

Install

Install with npm

npm install --save-dev gulp-template

Example

src/greeting.html

<h1>Hello <%= name %></h1>

gulpfile.js

var gulp = require('gulp');
var template = require('gulp-template');

gulp.task('default', function () {
    gulp.src('src/greeting.html')
        .pipe(template({name: 'Sindre'}))
        .pipe(gulp.dest('dist'));
});

dist/greeting.html

<h1>Hello Sindre</h1>

API

See the Lo-Dash _.template docs.

template(data, options)

data

Type: Object

The data object used to populate the text.

options

Type: Object

Lo-Dash _.template options.

Notes

If you use grunt instead of gulp, but want to perform a similar task, use grunt-template.

License

MIT © Sindre Sorhus

npm loves you