
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
grunt-nunjuckr
Advanced tools
Render your nunjucks templates to static files
If you haven't used Grunt before, check out the Getting Started guide.
Once you have installed the plugin via npm install --save-dev grunt-nunjuckr
include this in your Gruntfile.js
grunt.loadNpmTasks('grunt-nunjuckr');
Type: Object
Default: undefined
The data that is passed to the template.
Type: String
Default: .html
The file extension for the output.
Type: String
Default: .
The path where the templates can be found.
Type: Object
Default: undefined
Configures nunjucks to render with different tags
Type: Function
Default: undefined
A callback function that sets up the nunjucks environment. The environment is passed as a parameter and it is expected to return it.
For more infomation about nunjucks environments see https://mozilla.github.io/nunjucks/api.html#environment
Type: Function
Default: undefined
A preprocessor callback for the data coming in. Gets called on every file with the params data
and file
Render a single input file to a single output file.
grunt.initConfig({
nunjuckr : {
testSimple : {
options : {
data : grunt.file.readJSON('data/data.json')
},
files : [
{
src : 'src/input.njs',
dest : 'dest/output.html'
}
]
}
}
});
load different data files for every file in the templates folder.
var path = require('path');
grunt.initConfig({
nunjuckr : {
testExtended : {
options : {
data : grunt.file.readJSON('test/extended/data/data.json'),
ext : '.html'
searchPaths : 'src',
preprocessData : function (data, file) {
var fileExt = path.extname(file);
var filename = path.basename(file, fileExt);
var dir = path.dirname(file);
var jsonPath = path.join('test/extended/data/', dir, filename + '.json');
data = grunt.file.readJSON(jsonPath);
return data;
}
},
files : [
{
src : 'src/**/*.njs',
dest : 'dest/'
}
]
}
}
});
Set up a custom environment for the renderer.
grunt.initConfig({
nunjuckr : {
testExtended : {
options : {
data : grunt.file.readJSON('test/extended/data/data.json'),
ext : '.html',
searchPaths : 'test/extended/src',
setUp : function (env) {
env.addFilter('crop', function (str, count) {
return str.slice(0, count || 5);
});
return env;
}
},
files : [
{
src : 'test/extended/src/**/*.njs',
dest : 'test/extended/dest/'
}
]
}
}
});
FAQs
A grunt task rendering nunjucks templates to static html files.
The npm package grunt-nunjuckr receives a total of 0 weekly downloads. As such, grunt-nunjuckr popularity was classified as not popular.
We found that grunt-nunjuckr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.