gulp-nunjucks

Precompile Nunjucks templates

npm install gulp-nunjucks
1 downloads in the last day
4 downloads in the last week
32 downloads in the last month

gulp-nunjucks Build Status

Precompile Nunjucks templates

Issues with the output should be reported on the Nunjucks issue tracker.

Install

Install with npm

npm install --save-dev gulp-nunjucks

Example

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

gulp.task('default', function () {
    gulp.src('templates/list.html')
        .pipe(nunjucks())
        .pipe(gulp.dest('dist'));
});

API

nunjucks(options)

Same options as nunjucks.precompile() except for name.

options.name

Type: Function
Default: Relative template path. Example: templates/list.html

You can override the default behavior by supplying a function which gets the current File object and is expected to return the name.

Example:

{
    name: function (file) {
        return 'tpl-' + file.relative;
    }
}

License

MIT © Sindre Sorhus

npm loves you