File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org).
66
77## Head
88
9+ * Feature: adds ability to pass ` configure ` as ` nunjucks.Environment ` .
910* Fixed: all errors are sent into ` compilation.errors ` now.
1011* Fixed: use ` fs-extra ` to output file when ` writeToFileEmit: true ` .
1112* Changed: rename option from ` writeToFileWhenMemoryFs ` to ` writeToFileEmit ` .
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ export default {
7575 * ` writeToFileEmit ` - (optional, default: false) - If set to ` true ` will emit
7676 to build folder and memory in combination with ` webpack-dev-server `
7777
78- * ` configure ` - (optional) see
78+ * ` configure ` - (optional) ` object ` or ` nunjucks.Environment ` see
7979 [ configure] ( https://mozilla.github.io/nunjucks/api.html#configure ) options.
8080
8181## Contribution
Original file line number Diff line number Diff line change @@ -40,10 +40,13 @@ class NunjucksWebpackPlugin {
4040 }
4141
4242 compiler . plugin ( "emit" , ( compilation , callback ) => {
43- nunjucks . configure (
44- this . options . configure . path ,
45- this . options . configure . options
46- ) ;
43+ const configure =
44+ this . options . configure instanceof nunjucks . Environment
45+ ? this . options . configure
46+ : nunjucks . configure (
47+ this . options . configure . path ,
48+ this . options . configure . options
49+ ) ;
4750
4851 const promises = [ ] ;
4952
@@ -60,7 +63,7 @@ class NunjucksWebpackPlugin {
6063 fileDependencies . push ( template . from ) ;
6164 }
6265
63- const res = nunjucks . render (
66+ const res = configure . render (
6467 template . from ,
6568 template . context ? template . context : null ,
6669 template . callback ? template . callback : null
You can’t perform that action at this time.
0 commit comments