grunt-bake
Advanced tools
Comparing version 0.3.15 to 0.3.16
{ | ||
"name": "grunt-bake", | ||
"description": "Bake external includes into files to create static pages with no server-side compilation time", | ||
"version": "0.3.15", | ||
"version": "0.3.16", | ||
"homepage": "https://github.com/MathiasPaumgarten/grunt-bake", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -288,2 +288,5 @@ # grunt-bake [![Build Status](https://travis-ci.org/MathiasPaumgarten/grunt-bake.png?branch=master)](https://travis-ci.org/MathiasPaumgarten/grunt-bake) | ||
Alternativly, `_if` suppoerts two operators. the `==` and the `=!` operator. This allows to specify the name of the value and the content in single quotes, if the content is a string. | ||
__Note: This is a simple implementation of the equals operator and is based solely on strings.__ | ||
_app/base.html_: | ||
@@ -294,2 +297,4 @@ ```html | ||
<!--(bake includes/container.html _if="name")--> | ||
<!--(bake includes/other.html _if="foo == 'bar'")--> | ||
</body> | ||
@@ -299,2 +304,7 @@ </html> | ||
_includes/other.html_: | ||
```html | ||
<span>{{foo}}</span> | ||
``` | ||
_app/content.json_: | ||
@@ -313,2 +323,3 @@ | ||
<span>bar</span> | ||
</body> | ||
@@ -315,0 +326,0 @@ </html> |
@@ -196,2 +196,3 @@ /* | ||
function validateIf( inlineValues, values ) { | ||
if ( "_if" in inlineValues ) { | ||
@@ -202,2 +203,18 @@ | ||
var operator = getOperator( value ); | ||
if ( operator ) { | ||
var parts = value.split( operator ); | ||
var left = mout.string.rtrim( parts[ 0 ] ); | ||
var right = mout.string.ltrim( parts[ 1 ] ).replace( /'/g, "" ); | ||
var contentValue = resolveName( left, values ); | ||
if ( operator === "==" && contentValue === right ) return false; | ||
else if ( operator === "!=" && contentValue !== right ) return false; | ||
return true; | ||
} | ||
if ( ! hasValue( value, values ) ) return true; | ||
@@ -209,2 +226,12 @@ } | ||
function getOperator( string ) { | ||
var operators = [ "==", "!=" ]; | ||
for ( var i = 0; i < operators.length; i++ ) { | ||
if ( string.indexOf( operators[ i ] ) > -1 ) return operators[ i ]; | ||
} | ||
return false; | ||
} | ||
// Handle _render attributes in inline arguments | ||
@@ -211,0 +238,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
37200
581
535