Gathering detailed insights and metrics for gulp-render-nunjucks
Gathering detailed insights and metrics for gulp-render-nunjucks
Gathering detailed insights and metrics for gulp-render-nunjucks
Gathering detailed insights and metrics for gulp-render-nunjucks
gulp-nunjucks-render
Render Nunjucks templates with data
gulp-nunjucks-render-env
Render Nunjucks templates with data
gulp-nunjucks-api
Render Nunjucks templates with data, custom filters, custom context functions and options for other Nunjucks API features.
gulp-nunjucks-html
Render Nunjucks templates to HTML
npm install gulp-render-nunjucks
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
9 Stars
18 Commits
2 Forks
1 Watchers
1 Branches
1 Contributors
Updated on Jun 24, 2017
Latest Version
2.0.1
Package Id
gulp-render-nunjucks@2.0.1
Size
2.81 kB
NPM Version
3.9.3
Node Version
6.2.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A gulp plugin to render nunjucks templates with the following features:
gulp.src
, optionally with gulp-data
and/or a shared data contextfile.data
(via gulp-data) through one (or more) templates to create multiple outputsnpm install gulp-render-nunjucks --save-dev
While not required, gulp-data
and gulp-rename
are very useful with this plugin.
npm install gulp-data gulp-rename --save-dev
// Render gulp.src as nunjucks template(s).
// Use "render" when each source file is a nunjucks template.
// A simple use-case is to render a static site using nunjucks features such
// as include, extends etc.
require('gulp-render-nunjucks').render( [data] );
// Render template.njk for each file in gulp.src
// Use "template" to pass the source files as data to the template.
// A simple use case is a gulp.src of json, where each file should be rendered using the same
// template.
require('gulp-render-nunjucks').template('template.njk')
gulpfile.js
var rename = require('gulp-rename');
var njk = require('gulp-render-nunjucks');
gulp.task('html', function(){
return gulp.src(['tpl1.njk', 'tpl2.njk'])
.pipe(njk.render())
.pipe(rename({ extname: '.html' })
.pipe(gulp.dest('dest'));
});
output
dest/tpl1.html
dest/tpl2.html
gulpfile.js
var data = require('gulp-data');
var rename = require('gulp-rename');
var requireNew = require('require-new');
var njk = require('gulp-render-nunjucks');
gulp.task('html', function(){
return gulp.src(['data/foo.js', 'data/bar.json'], { base: 'data', read: false })
.pipe(data(function (file) {
return requireNew(file.path);
}))
.pipe(njk.template('foobar.njk'))
.pipe(rename({ extname: '.html' })
.pipe(gulp.dest('dest'));
});
output
dest/foo.html
dest/bar.html
gulpfile.js
var data = require('gulp-data');
var rename = require('gulp-rename');
var requireNew = require('require-new');
var njk = require('gulp-render-nunjucks');
gulp.task('html', function () {
return gulp.src(['data/foo.js', 'data/bar.json'], { base: 'data', read: false })
.pipe(data(function (file) {
return requireNew(file.path);
}))
.pipe(njk.template(function (file) {
if(file.relative === 'foo.js'){
return 'preview.njk';
}
return 'feature.njk';
}))
.pipe(rename({ extname: '.html' })
.pipe(gulp.dest('dest'));
});
output
dest/foo.html // rendered using preview.njk
dest/bar.html // rendered using feature.njk
If using gulp-data and passing a data context to render(), a merged context will be passed to the template.
When merging the data, keys from file.data
(from gulp-data
) will overwrite the default data context passed to render().
For example:
gulpfile.js
var data = require('gulp-data');
var rename = require('gulp-rename');
var njk = require('gulp-render-nunjucks');
gulp.task('html', function () {
return gulp.src(['tpl1.njk', 'tpl2.njk'])
.pipe(data(function (file) {
return {
// 1. 'message' will not be overwritten when data is merged
message: 'hello from ' + file.relative
}
}))
// 2. 'message' will be overwritten with the value from gulp-data.
.pipe(njk.render({ message: 'hello'))
.pipe(rename({ extname: '.html' })
.pipe(gulp.dest('dest'));
});
output
dest/tpl1.html // message = 'hello from tpl1.html'
dest/tpl2.html // message = 'hello from tpl2.html'
npm test
(or mocha
) - Runs all tests
npm run coverage
- Check code coverage
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/17 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More