Gathering detailed insights and metrics for gulp-nunjucks-html
Gathering detailed insights and metrics for gulp-nunjucks-html
Gathering detailed insights and metrics for gulp-nunjucks-html
Gathering detailed insights and metrics for gulp-nunjucks-html
npm install gulp-nunjucks-html
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
20 Stars
29 Commits
7 Forks
1 Watchers
1 Branches
4 Contributors
Updated on Sep 24, 2024
Latest Version
2.0.0
Package Id
gulp-nunjucks-html@2.0.0
Size
2.38 kB
NPM Version
2.14.2
Node Version
4.0.0
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
4
1
Render Nunjucks templates to HTML.
Issues with the output should be reported on the Nunjucks issue tracker.
$ npm install --save-dev gulp-nunjucks-html
1var gulp = require('gulp'); 2var nunjucks = require('gulp-nunjucks-html'); 3 4gulp.task('nunjucks', function() { 5 return gulp.src('app/templates/**/*.html') 6 .pipe(nunjucks({ 7 searchPaths: ['app/templates'] 8 })) 9 .pipe(gulp.dest('dist')); 10});
This plugin will emit an error for cases such as invalid Nunjucks syntax or missing imported files. If uncaught, the error will crash Gulp.
You will need to attach a listener for the error event emitted by the stream:
1gulp.task('nunjucks', function() { 2 return gulp.src('src/templates/*.html') 3 .pipe(nunjucks({ 4 searchPaths: ['src/templates'] 5 })) 6 .on('error', function(err) { 7 // err is the error thrown by the Nunjucks compiler. 8 }) 9 .pipe(gulp.dest('dist')); 10});
The context used for rendering (i.e. the object passed to nunjucks.renderString) is created by merging the locals
object (see Options) with other data passed down the stream by other plugins. Currently, this plugin supports gulp-data and gulp-front-matter.
Note that gulp-front-matter
has the highest priority, followed by gulp-data
and finally locals
.
1gulp.task('nunjucks', function() { 2 return gulp.src('src/templates/contact.html') 3 // Get data from a JSON file 4 .pipe(data(function(file) { 5 return require('./metadata/' + path.basename(file.path) + '.json'); 6 })) 7 // Extract the FrontMatter 8 .pipe(frontMatter()) 9 // Context is the FrontMatter of the file and the JSON data, plus the locals object. 10 .pipe(nunjucks({ 11 locals: { apiKey: 'secret-key-here' } 12 })) 13 .pipe(gulp.dest('dist')); 14});
Type: Array
Default: []
A list of paths to look for templates (see FileSystemLoader). Can also be a single path for where templates live, and it defaults to the current working directory.
Type: Object
Default: {}
An hash used as context for compiling the templates.
Type: Boolean
Default: false
Controls if output with dangerous characters are escaped automatically.
Type: Object
Default: Default Nunjucks syntax
Defines the syntax for Nunjucks tags. See Customizing Syntax.
Type: Function
Default: undefined
Use this function to extend the Nunjuck's Environment
object, adding custom filters, tags etc.
1gulp.task('html', function() { 2 return gulp.src('src/templates/*.html') 3 .pipe(nunjucks({ 4 searchPaths: ['src/templates'], 5 setUp: function(env) { 6 env.addFilter('greet', function(name) { 7 return 'Hello ' + name; 8 }); 9 return env; 10 } 11 })) 12 .pipe(gulp.dest('dist')); 13});
Type: String
Default: undefined
Change generated files extension by this extension instead of templates extension.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 3/29 approved changesets -- score normalized to 1
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
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license 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