Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

minify_html generate broken JavaScript #2731

Closed
st1020 opened this issue Dec 10, 2024 · 2 comments
Closed

minify_html generate broken JavaScript #2731

st1020 opened this issue Dec 10, 2024 · 2 comments

Comments

@st1020
Copy link

st1020 commented Dec 10, 2024

Bug Report

Environment

Zola version: 0.19.2

Expected Behavior

Minifying the HTML should generate right JavaScript.

Current Behavior

Minifying the HTML generated broken javascript.

Step to reproduce

Here is an example, the following HTML is minimized to:

<script>
  document.addEventListener("DOMContentLoaded", () =>
    renderMathInElement(document.body, {
      delimiters: [
        { left: "$$", right: "$$", display: true },
        { left: "$", right: "$", display: false },
      ],
      throwOnError: false,
    }),
  );
</script>
<script>document.addEventListener(`DOMContentLoaded`,()=>renderMathInElement(document.body,{delimiters:[{left:a,right:a,display:!0},{left:b,right:b,display:!1}],throwOnError:!1}))</script>

This is an error of minify-html, maybe we should:

  1. Use the latest minify-html from the master branch.
  2. Do not minifying JS:
    cfg.minify_js = true;
  3. Or just wait the minify-html release a new version (but it hasn't been updated for a year).
@Keats
Copy link
Collaborator

Keats commented Dec 10, 2024

I guess wilsonzlin/minify-html#197 is related. We should probably not minify JS then

@st1020
Copy link
Author

st1020 commented Dec 10, 2024

Yes, in particular minify-html seems to be poorly maintained. We can hardly expect a new version of it in the short term.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants