|
3 | 3 | All notable changes to this project will be documented in this file. |
4 | 4 | This project adheres to [Semantic Versioning](http://semver.org/). |
5 | 5 |
|
| 6 | +## [3.2.0] / 18 December 2019 |
| 7 | + |
| 8 | +### Added |
| 9 | + |
| 10 | +* [#728]: Expose ECMAScript Module in addition to UMD (CommonJS, AMD & global scope), by [@phillipj] and [@zekth]. |
| 11 | + |
| 12 | +### Using mustache.js as an ES module |
| 13 | + |
| 14 | +To stay backwards compatible with already using projects, the default exposed module format is still UMD. |
| 15 | +That means projects using mustache.js as an CommonJS, AMD or global scope module, from npm or directly from github.com |
| 16 | +can keep on doing that for now. |
| 17 | + |
| 18 | +For those projects who would rather want to use mustache.js as an ES module, the `mustache/mustache.mjs` file has to |
| 19 | +be `import`ed directly. |
| 20 | + |
| 21 | +Below are some usage scenarios for different runtimes. |
| 22 | + |
| 23 | +#### Modern browser with ES module support |
| 24 | + |
| 25 | +```html |
| 26 | +<!-- index.html --> |
| 27 | +<script type="module"> |
| 28 | + import mustache from "https://unpkg.com/mustache@3.2.0/mustache.mjs" |
| 29 | +
|
| 30 | + console.log(mustache.render('Hello {{name}}!', { name: 'Santa' })) |
| 31 | + // Hello Santa! |
| 32 | +</script> |
| 33 | +``` |
| 34 | + |
| 35 | +#### [Node.js](https://nodejs.org) (>= v13.2.0 or using --experimental-modules flag) |
| 36 | + |
| 37 | +```js |
| 38 | +// index.mjs |
| 39 | +import mustache from 'mustache/mustache.mjs' |
| 40 | + |
| 41 | +console.log(mustache.render('Hello {{name}}!', { name: 'Santa' })) |
| 42 | +// Hello Santa! |
| 43 | +``` |
| 44 | + |
| 45 | +ES Module support for Node.js will be improved in the future when [Conditional Exports](https://nodejs.org/api/esm.html#esm_conditional_exports) |
| 46 | +is enabled by default rather than being behind an experimental flag. |
| 47 | + |
| 48 | +More info in [Node.js ECMAScript Modules docs](https://nodejs.org/api/esm.html). |
| 49 | + |
| 50 | +#### [Deno](https://deno.land/) |
| 51 | + |
| 52 | +```js |
| 53 | +// index.ts |
| 54 | +import mustache from 'https://unpkg.com/mustache@3.2.0/mustache.mjs' |
| 55 | + |
| 56 | +console.log(mustache.render('Hello {{name}}!', { name: 'Santa' })) |
| 57 | +// Hello Santa! |
| 58 | +``` |
| 59 | + |
6 | 60 | ## [3.1.0] / 13 September 2019 |
7 | 61 |
|
8 | 62 | ### Added |
@@ -357,6 +411,7 @@ This release is made to revert changes introduced in [2.3.1] that caused unexpec |
357 | 411 | * Fixed a bug that clashed with QUnit (thanks [@kannix]). |
358 | 412 | * Added volo support (thanks [@guybedford]). |
359 | 413 |
|
| 414 | +[3.2.0]: https://github.com/janl/mustache.js/compare/v3.1.0...v3.2.0 |
360 | 415 | [3.1.0]: https://github.com/janl/mustache.js/compare/v3.0.3...v3.1.0 |
361 | 416 | [3.0.3]: https://github.com/janl/mustache.js/compare/v3.0.2...v3.0.3 |
362 | 417 | [3.0.2]: https://github.com/janl/mustache.js/compare/v3.0.1...v3.0.2 |
@@ -424,6 +479,7 @@ This release is made to revert changes introduced in [2.3.1] that caused unexpec |
424 | 479 | [#714]: https://github.com/janl/mustache.js/issues/714 |
425 | 480 | [#716]: https://github.com/janl/mustache.js/issues/716 |
426 | 481 | [#717]: https://github.com/janl/mustache.js/issues/717 |
| 482 | +[#728]: https://github.com/janl/mustache.js/issues/728 |
427 | 483 |
|
428 | 484 | [@afc163]: https://github.com/afc163 |
429 | 485 | [@andersk]: https://github.com/andersk |
@@ -468,7 +524,8 @@ This release is made to revert changes introduced in [2.3.1] that caused unexpec |
468 | 524 | [@TiddoLangerak]: https://github.com/TiddoLangerak |
469 | 525 | [@tomekwi]: https://github.com/tomekwi |
470 | 526 | [@wizawu]: https://github.com/wizawu |
| 527 | +[@wol-soft]: https://github.com/wol-soft |
471 | 528 | [@Xcrucifier]: https://github.com/Xcrucifier |
472 | 529 | [@yotammadem]: https://github.com/yotammadem |
473 | 530 | [@yousefcisco]: https://github.com/yousefcisco |
474 | | -[@wol-soft]: https://github.com/wol-soft |
| 531 | +[@zekth]: https://github.com/zekth |
0 commit comments