nunjucks-webpack-plugin
A webpack plugin for nunjucks.
Install
npm install --save-dev nunjucks-webpack-plugin
Usage
; plugins: templates: from: "/path/to/template.njk" to: "template.html" ;
It is possible to use multiple templates:
; plugins: templates: from: "/path/to/template.njk" to: "template.html" from: "/path/to/next-template.njk" to: "next-template.html" ;
Options
-
templates
- (require)array
list of templates.-
from
- (require)string
path to template. -
to
- (require)string
destination path include filename and extension (relativeoutput
webpack option). -
context
- (optional) instead globalcontext
(see above), see render second argument. The following webpack compilation variables are also sent through to the template under the__webpack__
object:- hash
-
callback
- (optional) instead globalcallback
(see above), see render third argument. -
writeToFileEmit
- (optional, default: false) - If set totrue
will emit to build folder and memory in combination withwebpack-dev-server
-
-
configure
- (optional)object
ornunjucks.Environment
see configure options.
Contribution
Feel free to push your code if you agree with publishing under the MIT license.