data.yml
title: my data score: 32
template.mustache
title: my data score: 32
コマンドライン
[vagrant@localhost mustache]$ mustache data.yml template.mustache - my data - 32
title: my data score: 32 html: <p>
- {{title}}
- {{score}}
- {{{html}}}
- {{&html}}
区切り記号の変更
- {{=<% %>=}}
- <% html %>
<%={{ }}=%>
真偽値の表示
{{#showScore}}
- {{score}}
{{/showScore}}
{{^showScore}}
- score not available
{{/showScore}}
複雑なデータ処理
users:
- name: yamada
email: yamada@gmail.com
- name: hayashi
email: hayashi@gmail.com
{{#users}}
- {{name}}({{email}})
{{/users}}
部品化して書くことも可能です
{{#users}}
{{>user}}
{{/users}}