terser / html-minifier-terser

actively maintained fork of html-minifier - minify HTML, CSS and JS code using terser - supports ES6 code
https://terser.org/html-minifier-terser
MIT License
376 stars 30 forks source link

Add flag to remove newline before tag close #85

Closed lucamattiazzi closed 2 years ago

lucamattiazzi commented 3 years ago

creates a new flag that allows the user to avoid adding newlines before the closing tag in order to both solve issue #84 and not change how the library works

Fixes #84

sibiraj-s commented 2 years ago

I have some mixed opinions about this option. Let me get back on this.

sibiraj-s commented 2 years ago

I think this is fine. This is the shortest and non breaking fix can be done I guess.

Just thinking out loud.

DanielRuf commented 2 years ago
  • I am also having thoughts about switching to some well maintained parser. like parse5 or htmlparser2 or some other parsers, so that this package can let alone focus on minifying html.

Definitely a good idea. I am currently unsure but afaik there were discussions regarding this for html-minifier. See https://github.com/kangax/html-minifier/issues/155

sibiraj-s commented 2 years ago

Definitely a good idea. I am currently unsure but afaik there were discussions regarding this for html-minifier. See kangax/html-minifier#155

Thanks, will check it out.

sibiraj-s commented 2 years ago

I would prefer this

const endTagMatch = results[0].match(endTag)
const forceSameLine = endTagMatch && inlineTextTags(endTagMatch[1])

Its breaking, but it is the correct behaviour I think. May be for v7.

DanielRuf commented 2 years ago

CI - Node 16 (ubuntu-latest) Expected — Waiting for status to be reported

I'm wondering what happened with the CI build.

sibiraj-s commented 2 years ago

CI - Node 16 (ubuntu-latest) Expected — Waiting for status to be reported

I'm wondering what happened with the CI build.

Yeah I was waiting for the same. I think it is the branch protection rule. checking

sibiraj-s commented 2 years ago

Okay. Found it I guess. the workflow was waiting for approval to run for first time contributors. Since it is not approved for more than 30 days, It got expired.

DanielRuf commented 2 years ago

Okay. Found it I guess. the workflow was waiting for approval to run for first time contributors. Since it is not approved for more than 30 days, It got expired.

Ah, can we somehow trigeger a new build? Optionally we can maybe push a commit Trigger CI without any changes (--allow-empty).

sibiraj-s commented 2 years ago

Ah, can we somehow trigeger a new build? Optionally we can maybe push a commit Trigger CI without any changes (--allow-empty).

Pushed a small change. we can squash merge the PR.

sibiraj-s commented 2 years ago

Making a release now.

sibiraj-s commented 2 years ago

Published in v6.1.0

DanielRuf commented 2 years ago

@lucamattiazzi thank you very much for your contribution :+1:

lucamattiazzi commented 2 years ago

thank you for your library! and thanks for approving&merging!