grunt-bake
Advanced tools
Comparing version 0.3.10 to 0.3.12
@@ -213,2 +213,13 @@ /* | ||
} | ||
}, | ||
render_bake: { | ||
options: { | ||
foo: false, | ||
bar: true | ||
}, | ||
files: { | ||
"tmp/render_bake.html": "test/fixtures/render_bake.html" | ||
} | ||
} | ||
@@ -215,0 +226,0 @@ } |
{ | ||
"name": "grunt-bake", | ||
"description": "Bake external includes into files to create static pages with no server-side compilation time", | ||
"version": "0.3.10", | ||
"version": "0.3.12", | ||
"homepage": "https://github.com/MathiasPaumgarten/grunt-bake", | ||
@@ -26,3 +26,3 @@ "author": { | ||
"engines": { | ||
"node": ">= 0.8.0" | ||
"node": ">= 0.10.0" | ||
}, | ||
@@ -29,0 +29,0 @@ "scripts": { |
@@ -149,2 +149,3 @@ # grunt-bake [![Build Status](https://travis-ci.org/MathiasPaumgarten/grunt-bake.png?branch=master)](https://travis-ci.org/MathiasPaumgarten/grunt-bake) | ||
### Usage Examples | ||
@@ -437,2 +438,47 @@ | ||
#### Inline _render statement | ||
The `_render` statement simular to the `_if` statement determines whether or not the include is parsed. | ||
However the `_render` statement looks for it's counterpart in the options not in the content JSON. It then | ||
determines whether or not the field exists and if so, if the field has a truthy value. | ||
If the field doesnt exist the `_render` will be ignored. If it does existes a `true` value will render the template | ||
and a `false` value will skip the template. | ||
_app/base.html_: | ||
```html | ||
<html> | ||
<body> | ||
<!--(bake includes/file.html _render="baseline")--> | ||
</body> | ||
</html> | ||
``` | ||
With the following grunt task: | ||
```js | ||
bake: { | ||
your_target: { | ||
options: { | ||
baseline: false | ||
}, | ||
files: { | ||
"dist/index.html": "app/base.html" | ||
} | ||
}, | ||
} | ||
``` | ||
This will create: | ||
_dist/index.html_: | ||
```html | ||
<html> | ||
<body> | ||
</body> | ||
</html> | ||
``` | ||
#### Costum process | ||
@@ -439,0 +485,0 @@ This example shows the use of a costum process funtion. |
@@ -183,3 +183,18 @@ /* | ||
// Handle _render attributes in inline arguments | ||
function validateRender( inlineValues ) { | ||
if ( "_render" in inlineValues ) { | ||
var skipValue = inlineValues[ "_render" ]; | ||
if ( skipValue in options ) { | ||
return ! options[ skipValue ]; | ||
} | ||
} | ||
return false; | ||
} | ||
// Handle _section attributes in inline arguments | ||
@@ -237,2 +252,3 @@ | ||
if ( validateIf( inlineValues, values ) ) return ""; | ||
if ( validateRender( inlineValues ) ) return ""; | ||
@@ -277,2 +293,3 @@ var forEachValues = []; | ||
if ( validateRender( inlineValues ) ) return ""; | ||
if ( validateIf( inlineValues, values ) ) return ""; | ||
@@ -279,0 +296,0 @@ |
@@ -24,3 +24,4 @@ "use strict"; | ||
"tmp/object_bake.html": "test/expected/object_bake.html", | ||
"tmp/section_bake.html": "test/expected/section_bake.html" | ||
"tmp/section_bake.html": "test/expected/section_bake.html", | ||
"tmp/render_bake.html": "test/expected/render_bake.html" | ||
}; | ||
@@ -27,0 +28,0 @@ |
Sorry, the diff of this file is not supported yet
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
32958
45
505
519