Skip to content

Commit

Permalink
Upgrade rollup pipeline & fix minification
Browse files Browse the repository at this point in the history
The closure compiler has been replaced by terser for the minification step, as
closure does not handle correctly variables (or in this case constants)
declared with the same name as some globals (in this case `document`). This is
a valid error for scripts, but in ES modules this kind of redeclarations do not
cause problems (at least for `document`).

For details see:
- ampproject/rollup-plugin-closure-compiler#92
- google/closure-compiler#3098
- google/closure-compiler#2471

Also terser is way faster than closure, and produces a slightly smaller
minified script.
  • Loading branch information
crazygolem committed Aug 7, 2021
1 parent b1336ff commit 9d584e6
Show file tree
Hide file tree
Showing 5 changed files with 391 additions and 606 deletions.
2 changes: 1 addition & 1 deletion demo/footnotes.htm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}
</style>
<script type="module" defer>
import { ast } from '../dist/markdown-muncher.mjs'
import { ast } from '../dist/markdown-muncher.min.mjs'

document.querySelectorAll('script[type="text/markdown"').forEach((n) => {
n.insertAdjacentHTML('beforebegin', '<pre>' + ast(n.textContent) + '</pre>')
Expand Down
2 changes: 1 addition & 1 deletion demo/index.htm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}
</style>
<script type="module" defer>
import process from '../dist/markdown-muncher.mjs'
import process from '../dist/markdown-muncher.min.mjs'

document.querySelectorAll('script[type="text/markdown"').forEach((n) => {
process(n.textContent).then((html) => {
Expand Down
Loading

0 comments on commit 9d584e6

Please sign in to comment.