Skip to content

ryanluton/gulp-nunjucks-render

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gulp-nunjucks-render

Render Nunjucks templates

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

Install

Install with npm

npm install --save-dev gulp-nunjucks-render

Example

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

gulp.task('default', function () {
	nunjucksRender.nunjucks.configure(['src/templates/']);
	return gulp.src('src/templates/*.html')
		.pipe(nunjucksRender())
		.pipe(gulp.dest('dist'));
});

Note: To keep Nunjucks render from eating up all your ram, make sure to specify your watch path. nunjucksRender.nunjucks.configure(['src/path/to/templates/']); This will also allow you to define your paths relatively.

API

nunjucks-render(context)

Same context as nunjucks.render().

For example

nunjucksRender({css_path: 'http://company.com/css/'});

For the following template

<link rel="stylesheet" href="{{ css_path }}test.css" />

Would render

<link rel="stylesheet" href="http://company.com/css/test.css" />

License

MIT © Carlos G. Limardo

Shout-outs

Sindre Sorhus who wrote the original gulp-nunjucks for precompiling Nunjucks templates. I updated his to render instead of precompile.

About

fork of https://github.com/carlosl/gulp-nunjucks-render modified to include gulp-data for views task with generator gulp-webapp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%