Skip to content

Instantly share code, notes, and snippets.

@mehfuzh
Forked from Dammmien/mustache.md
Created August 16, 2019 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mehfuzh/b18d513b3dc1f2f62d4a10b9bbd33fe1 to your computer and use it in GitHub Desktop.
Save mehfuzh/b18d513b3dc1f2f62d4a10b9bbd33fe1 to your computer and use it in GitHub Desktop.
Mustache cheatsheet

Basic tag

  Hello {{name}} !!

Loop over a list property

{{#list}}
  {{property}} // item.property
  or
  {{.}} // item
{{/list}}

Show a block if a property is an empty list or falsy

{{^variable}}
  variable is a falsy
{{/variable}}

Show a block if a property truthy

{{#variable}}
  variable is truthy
{{/variable}}

Imports an other template

{{> header}}

Render unescaped HTML

{{{<span>unescaped</span>}}} or {{&<span>unescaped</span>}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment