Created
April 10, 2015 15:17
-
-
Save andreruffert/eae466e184343f4f14a2 to your computer and use it in GitHub Desktop.
Passing data to assemble partials
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
myPartial: | |
cssClass: myPartialCssClass | |
--- | |
{{> partial myPartial}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="{{{cssClass}}}"></div> |
Not sure if there is a better solution right now but this should work though.
I used it in a project some time ago...
page.html
{{#parseJSON '{"cssClass": "myPartialCssClass"}'}}
{{> partial }}
{{/parseJSON}}
partial.html
<div class="{{{cssClass}}}"></div>
Thank you sooooo much @andreruffert!!!!!!
👌 ✌️
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Okay, that's cool but let's say I have to include the partial twice on the same page with different classes. How can I achieve that?