Skip to content

Mustache Text

MrCai edited this page Jul 21, 2022 · 1 revision

Mustache syntax ({{}}) distinguishes variable strings from normal plain strings.

When Cue meets mustache syntax in HTML, it will attempt to find the corresponding variable in data field specified in script file. If found, it will replace the whole mustache text with the value of the variable. Otherwise, the text fallbacks to "".

The text content gets automatically updated if variable value changes.

<!-- index.html -->
<p>{{ message }}</p>
// main.ts
data: {
  message: "Hello world",
}
<!-- Compile result -->
<p>Hello world</p>
Clone this wiki locally