@dryfeld/nunjucks-loader 4.0.2 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +10 -9
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -27,20 +27,21 @@ module.exports = function (source) {
|
|
|
27
27
|
if (!hasRun) {
|
|
28
28
|
const query = new URLSearchParams(this.query);
|
|
29
29
|
|
|
30
|
-
envOpts = query.opts || {};
|
|
31
|
-
if (query){
|
|
30
|
+
envOpts = query.get('opts') || {};
|
|
31
|
+
if (query) {
|
|
32
32
|
|
|
33
33
|
env = new nunjucks.Environment([], envOpts);
|
|
34
34
|
|
|
35
|
-
if (query.config){
|
|
36
|
-
pathToConfigure = query.config;
|
|
35
|
+
if (query.get('config')) {
|
|
36
|
+
pathToConfigure = query.get('config');
|
|
37
37
|
try {
|
|
38
|
-
const configure = require(query.config);
|
|
38
|
+
const configure = require(path.resolve(__dirname,'../../../' + query.get('config')));
|
|
39
|
+
|
|
39
40
|
configure(env);
|
|
40
41
|
}
|
|
41
42
|
catch (e) {
|
|
42
43
|
if (e.code === 'MODULE_NOT_FOUND') {
|
|
43
|
-
if (!query.quiet) {
|
|
44
|
+
if (!query.get('quiet')) {
|
|
44
45
|
const message = 'Cannot configure nunjucks environment before precompile\n' +
|
|
45
46
|
'\t' + e.message + '\n' +
|
|
46
47
|
'Async filters and custom extensions are unsupported when the nunjucks\n' +
|
|
@@ -59,12 +60,12 @@ module.exports = function (source) {
|
|
|
59
60
|
|
|
60
61
|
// Specify the template search path, so we know from what directory
|
|
61
62
|
// it should be relative to.
|
|
62
|
-
if (query.root) {
|
|
63
|
-
root = query.root;
|
|
63
|
+
if (query.get('root')) {
|
|
64
|
+
root = query.get('root');
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
// Enable experimental Jinja compatibility to be enabled
|
|
67
|
-
if(query.jinjaCompat){
|
|
68
|
+
if(query.get('jinjaCompat')){
|
|
68
69
|
jinjaCompatStr = 'nunjucks.installJinjaCompat();\n';
|
|
69
70
|
}
|
|
70
71
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dryfeld/nunjucks-loader",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "A nunjucks loader for webpack.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "git://github.com/
|
|
11
|
+
"url": "git://github.com/jsutciffe/nunjucks-loader.git"
|
|
12
12
|
},
|
|
13
13
|
"keywords": [
|
|
14
14
|
"webpack",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"loader",
|
|
18
18
|
"template"
|
|
19
19
|
],
|
|
20
|
-
"author": "Ben Daley <ben@fanboy.io>",
|
|
20
|
+
"author": "Ben Daley <ben@fanboy.io>, modifications by Jonathan Sutcliffe <jonathan.sutcliffe@gov.scot>",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"bugs": {
|
|
23
|
-
"url": "https://github.com/
|
|
23
|
+
"url": "https://github.com/jsutcliffe/nunjucks-loader/issues"
|
|
24
24
|
},
|
|
25
|
-
"homepage": "https://github.com/
|
|
25
|
+
"homepage": "https://github.com/jsutcliffe/nunjucks-loader",
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"nunjucks": ">= 2.5.0 <= 4.0.0"
|
|
28
28
|
},
|