grunt-nunjuckr
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -115,2 +115,17 @@ module.exports = function (grunt) { | ||
] | ||
}, | ||
testGlobal: { | ||
options : { | ||
data : grunt.file.readJSON('test/globals/data/data.json'), | ||
globals: { | ||
globalTitle: 'This is a global title' | ||
} | ||
}, | ||
files : [ | ||
{ | ||
src : 'test/globals/src/index.njs', | ||
dest : 'test/globals/dest/index.html' | ||
} | ||
] | ||
} | ||
@@ -117,0 +132,0 @@ } |
{ | ||
"name": "grunt-nunjuckr", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "A grunt task rendering nunjucks templates to static html files.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -45,2 +45,37 @@ # grunt-nunjuckr | ||
### Globals | ||
Type: `Object` or `Array` | ||
Default: `undefined` | ||
Gives you the ability to specify globals within your config. There are two ways to do that: By | ||
using an object or by using an array. | ||
This example uses an object: | ||
```javascript | ||
{ | ||
options: { | ||
globals: { | ||
globalName: 'Global Value' | ||
} | ||
} | ||
} | ||
``` | ||
This example uses an array: | ||
```javascript | ||
{ | ||
options: { | ||
globals: [ | ||
{ | ||
name: 'globalName', | ||
value: 'Global Value' | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
### ContentDimensions | ||
@@ -47,0 +82,0 @@ |
@@ -26,2 +26,15 @@ /** | ||
if (typeof options.globals === 'object') { | ||
for (var globalName in options.globals) { | ||
var globalVal = options.globals[globalName]; | ||
njEnv.addGlobal(globalName, globalVal); | ||
} | ||
} else if (typeof options.globals === 'array') { | ||
options.globals.forEach(function(globalObj) { | ||
if (typeof globalObj === 'object') { | ||
njEnv.addGlobal(globalObj.name, globalObj.value); | ||
} | ||
}); | ||
} | ||
var renderFiles = ( function( contentDimensions ) { | ||
@@ -28,0 +41,0 @@ var fileIterator = function(callback) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20731
26
254
242