Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mustache cheatsheet

Basic tag

  Hello {{name}} !!

Comments

  {{! This is a comment, and it won't be rendered }}

Loop through a list of items

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

Show a block if a variable is falsy, an empty list or a function returning a falsy value

{{^variable}}
  variable is a falsy or an empty list
{{/variable}}

Show a block if a variable is truthy or a function returning a truthy value

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

Import / include another template

{{> header}}

Render unescaped HTML

{{{<span>unescaped</span>}}} or {{&<span>unescaped</span>}}
@xcesaralejandro

This comment has been minimized.

Copy link

@xcesaralejandro xcesaralejandro commented Jan 2, 2020

useful summary

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment