Get started with mustache.js CDN

MIT licensed

Lightweight JS templating engine: Mustache.js renders dynamic HTML from templates and data.

Tags:
  • templates
  • templating
  • mustache
  • template
  • ejs

Stable version

Copied!

How to start using mustache.js CDN


<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.cdnhub.io/mustache.js/4.2.0/mustache.min.js"></script>
  <script>
    const template = `
      <ul>
        {{#people}}
          <li>{{name}} ({{age}})</li>
        {{/people}}
      </ul>
    `;

    const data = {
      people: [
        { name: "John Doe", age: 25 },
        { name: "Jane Doe", age: 30 },
      ],
    };

    const rendered = Mustache.render(template, data);
    document.body.innerHTML = rendered;
  </script>
</head>
<body></body>
</html>
Copied!
Copied!

All versions