Name: nunjucks-webpack-plugin
Owner: FT Interactive News
Description: A webpack plugin for nunjucks.
Forked from: itgalaxy/nunjucks-webpack-plugin
Created: 2017-07-21 15:35:25.0
Updated: 2017-07-21 15:35:26.0
Pushed: 2017-11-22 16:41:59.0
Homepage: null
Size: 81
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
A webpack plugin for nunjucks.
install --save-dev nunjucks-webpack-plugin
rt NunjucksWebpackPlugin from 'nunjucks-webpack-plugin';
rt default {
ugins: [
new NunjucksWebpackPlugin({
template: {
from: '/path/to/template.njk',
to: 'template.html'
}
})
It is possible to use multiple templates:
rt NunjucksWebpackPlugin from 'nunjucks-webpack-plugin';
rt default {
ugins: [
new NunjucksWebpackPlugin({
template: [{
from: '/path/to/template.njk',
to: 'template.html'
}, {
from: '/path/to/next-template.njk',
to: 'next-template.html'
}]
})
template
- (require) object
or array
paths (from
, to
and etc.) to templates.
from
- (require) string
path to template.
to
- (require) string
destination path include filename and extension (relative output
webpack option).
context
- (optional) instead global context
(see above),
see render second argument.
callback
- (optional) instead global callback
(see above),
see render third argument.
writeToFileWhenMemoryFs
- (optional) instead global writeToFileWhenMemoryFs
(see above),
context
- (optional) use if template context
is null or undefined,
see render second argument.
callback
- (optional) use if template callback
is null or undefined,
see render third argument.
configure
- (optional) see configure options.
writeToFileWhenMemoryFs
- (optional, default: false) - write templates to disk when using Memory filesystem,
useful when use watch
.
Feel free to push your code if you agree with publishing under the MIT license.