Changelog
[4.1.0] / 6 December 2020
render()
now recognizes a config object argument, by [@pineapplemachine].escape
functions to escape all types of values (including number
s), by [@pineapplemachine].Changelog
[4.0.1] / 15 March 2020
Changelog
[4.0.0] / 16 January 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.
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
}
.to_html()
, by [@phillipj].Changelog
[3.2.1] / 30 December 2019
Changelog
[3.2.0] / 18 December 2019