All Versions
33
Latest Version
Avg Release Cycle
101 days
Latest Release
-

Changelog History
Page 1

  • v13.2.0 Changes

    // index.mjs
    import mustache from 'mustache/mustache.mjs'
    
    console.log(mustache.render('Hello {{name}}!', { name: 'Santa' }))
    // Hello Santa!
    

    ES Module support for Node.js will be improved in the future when Conditional Exports 0️⃣ is enabled by default rather than being behind an experimental flag.

    📄 More info in Node.js ECMAScript Modules docs.

  • v4.2.0 Changes

    March 28, 2021

    ➕ Added

    • 📦 [#773]: Add package.json exports field, by [@manzt].
  • v4.1.0 Changes

    December 06, 2020

    ➕ Added

    • [#764]: render() now recognizes a config object argument, by [@pineapplemachine].

    🛠 Fixed

    • [#764]: Ask custom escape functions to escape all types of values (including numbers), by [@pineapplemachine].
  • v4.0.1 Changes

    March 15, 2020

    🛠 Fixed

    • [#739]: Fix custom delimiters in nested partials, by [@aielo].
  • v4.0.0 Changes

    January 16, 2020

    Majority of using projects don't have to worry by this being a new major version.

    TLDR; if your project manipulates Writer.prototype.parse | Writer.cache directly or uses .to_html(), you probably have to change that code.

    🚀 This release allows the internal template cache to be customised, either by disabling it completely 📜 or provide a custom strategy deciding how the cache should behave when mustache.js parses templates.

    const mustache = require('mustache');
    
    // disable caching
    Mustache.templateCache = undefined;
    
    // or use a built-in Map in modern environments
    Mustache.templateCache = new Map();
    

    Projects that wanted to customise the caching behaviour in earlier versions of mustache.js were forced to 📜 override internal method responsible for parsing templates; Writer.prototype.parse. In short, that was unfortunate because there is more than caching happening in that method.

    We've improved that now by introducing a first class API that only affects template caching.

    0️⃣ The default template cache behaves as before and is still compatible with older JavaScript environments. For those who wants to provide a custom more sopisiticated caching strategy, one can do that with an object that adheres to the following requirements:

    {
      set(cacheKey: string, value: string): void
      get(cacheKey: string): string | undefined
      clear(): void
    }
    

    ➕ Added

    • [#731]: Allow template caching to be customised, by [@AndrewLeedham].

    ✂ Removed

    • 🚚 [#735]: Remove .to_html(), by [@phillipj].
  • v3.2.1 Changes

    December 30, 2019

    🛠 Fixed

    • [#733]: Allow the CLI to use JavaScript views when the project has ES6 modules enabled, by [@eobrain].
  • v3.2.0 Changes

    December 18, 2019

    ➕ 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>
    
  • v3.1.0 Changes

    September 13, 2019

    ➕ Added

    • 👍 #717: Added support .js files as views in command line tool, by @JEStaubach.

    🛠 Fixed

  • v3.0.3 Changes

    August 27, 2019

    ➕ Added

    • [#713]: Add test cases for custom functions in partials, by [@wol-soft].

    🛠 Fixed

    • [#714]: Bugfix for wrong function output in partials with indentation, by [@phillipj].
  • v3.0.2 Changes

    August 21, 2019

    🛠 Fixed

    Dev

    • #701: Fix test failure for Node 10 and above, by @andersk.
    • 👕 #704: Lint all test files just like the source files, by @phillipj.
    • Start experimenting & comparing GitHub Actions vs Travis CI, by @phillipj.