All Versions
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 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 "[email protected]/mustache.mjs"
      console.log(mustache.render('Hello {{name}}!', { name: 'Santa' }))
      // Hello Santa!
  • v3.1.0 Changes

    September 13, 2019

    โž• Added

    • ๐Ÿ‘ #717: Added support .js files as views in command line tool, by @JEStaubach.

    ๐Ÿ›  Fixed

    • ๐Ÿ›  #716: Bugfix for indentation of inline partials, by @yotammadem.
  • 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


    • โœ… #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.