Created
September 4, 2014 06:26
-
-
Save rek/f18a7e38b8e4e3686584 to your computer and use it in GitHub Desktop.
Dust.js Cheatsheet
This file contains 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
{?cond} | |
cond is true | |
{:else} | |
cond is not true | |
{/cond} | |
{^cond} | |
cond is false | |
{:else} | |
cond is not false | |
{/cond} | |
{#loop} | |
<label>{something}{~n} | |
<option value="{value}" {@eq key=value value=courseName}selected="true"{/eq}>{label}</option> | |
</label> | |
{:else} | |
show if loop empty | |
{/loop} | |
{>partial_name /} | |
{>"flowViews/flowView{flowName}" /} | |
{@select key=\"{foo}\"} | |
{@eq value=\"bar\"}foobar{/eq} | |
{@eq value=\"baz\"}foobaz{/eq} | |
{@default} - default Text{/default} | |
{/select} | |
{@select key=foo} | |
{@gte value=5}foobar{/gte} | |
{/select} | |
{@if cond="{x} < {y} && {b} == {c} && '{e}'.length || '{f}'.length"} | |
<div> x is less than y and b == c and either e or f exists in the output </div> | |
{/if} | |
{@size key="xxx" } | |
My friends are: | |
{#friends} | |
{name}{@sep},{/sep} | |
{/friends} | |
The {@sep} helper tag will output it's body content unless this is the final iteration of the containing loop. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment