Skip to content

Instantly share code, notes, and snippets.

@morontt
Created April 7, 2015 12:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save morontt/60c71231a33a9b66c826 to your computer and use it in GitHub Desktop.
Save morontt/60c71231a33a9b66c826 to your computer and use it in GitHub Desktop.
twig.js inline template
var html = twig({ ref: "user-profile" }).render({
list: ["a", "b", "c"]
});
twig({
id: "user-profile",
data: "<div class=\"discount-splash-action-details-outer\">\
<div class=\"discount-splash _{{ percentDiscount|number_format }}\">\
bis\
<strong>-{% if percentDiscount is defined %}{{ percentDiscount }}%{% endif %}</strong>\
</div>\
</div>\
<div class=\"discount-splash-action-details-outer display-none\">\
<div class=\"discount-splash _{{ crossPrice|number_format }}\">\
&nbsp;\
<strong><s>{% if crossPrice is defined %}{{ crossPrice |number_format(0, ',', '.') }} &euro;{% endif %}</s></strong>\
</div>\
</div>"
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment