mustache.js v3.2.0 Release Notes

Release Date: 2019-12-18 // over 4 years ago
  • ➕ Added

    • [#728]: Expose ECMAScript Module in addition to UMD (CommonJS, AMD & global scope), by [@phillipj] and [@zekth].

    Using mustache.js as an ES module

    0️⃣ To stay backwards compatible with already using projects, the default exposed module format is still UMD. That means projects using mustache.js as an CommonJS, AMD or global scope module, from npm or directly from github.com can keep on doing that for now.

    For those projects who would rather want to use mustache.js as an ES module, the mustache/mustache.mjs file has to be imported directly.

    Below are some usage scenarios for different runtimes.

    💻 Modern browser with ES module support

    <!-- index.html -->
    <script type="module">
      import mustache from "https://unpkg.com/[email protected]/mustache.mjs"
    
      console.log(mustache.render('Hello {{name}}!', { name: 'Santa' }))
      // Hello Santa!
    </script>