gulp-nunjucks

Precompile Nunjucks templates

gulp-nunjucks

Precompile Nunjucks templates

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

$ npm install --save-dev gulp-nunjucks
var gulp = require('gulp');
var nunjucks = require('gulp-nunjucks');
 
gulp.task('default', function () {
    return gulp.src('templates/list.html')
        .pipe(nunjucks())
        .pipe(gulp.dest('dist'));
});

Same options as nunjucks.precompile() except for 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:

{
    namefunction (file) {
        return 'tpl-' + file.relative;
    }
}

MIT © Sindre Sorhus