Skip to content

Commit f25abbe

Browse files
committed
Introduce build step to generate .js | .min.js from .mjs
By making the main source code an ES module placed in `mustache.mjs`, what used to be in `mustache.js` is now built based off of the ES module source inside `mustache.mjs`. This is done primarily to avoid breaking existing projects already using mustache.js, by keeping the UMD-version in `mustache.js` part of the git repository in addition to the minified version in `mustache.min.js`. After experiment with several compilers; - Babel - TypeScript - Rollup and examining their build output, [Rollup](https://rollupjs.org/) was chosen because of the UMD output it creates which closely resembles what we've historically had in the previous `mustache.js` source code. The contents of `.js | .min.js` files has been generated by running the following npm script: ``` $ npm run build ``` Also change linting w/eslint to target the `.mjs` file, since the output of rollup that ends up in the old `mustache.js` file is not sensible to do linting on.
1 parent b523b16 commit f25abbe

File tree

5 files changed

+769
-33
lines changed

5 files changed

+769
-33
lines changed

.eslintrc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,14 @@
1616
"no-use-before-define": 0,
1717
"no-process-exit": 0,
1818
"strict": 0
19-
}
19+
},
20+
"overrides": [
21+
{
22+
"files": ["mustache.mjs"],
23+
"parserOptions": {
24+
"sourceType": "module",
25+
"ecmaVersion": 2015
26+
}
27+
}
28+
]
2029
}

0 commit comments

Comments
 (0)