rbvea / gulp-nunjucks

Precompile Nunjucks templates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gulp-nunjucks Build Status

Precompile Nunjucks templates

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

Install

$ npm install --save-dev gulp-nunjucks

Usage

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'));
});

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

About

Precompile Nunjucks templates

License:MIT License


Languages

Language:JavaScript 100.0%