Open cdtut opened 6 months ago
@matthewp Can it be high priority? Production build has lots of whitespace errors that can't be released.
@matthewp Can it be high priority? Production build has lots of whitespace errors that can't be released.
You can disable compression for the time. You have the option.
It's not very clear the expected result VS the current result, could you move them into a code block so it's more evident?
@ematipico
Original:
<h1>
<span>span</span>
<span>span</span>
</h1>
Expected:
Like html-minifier-terser conservativeCollapse
<h1><span>word</span> <span>word</span></h1>
Or this way simpler but file is bigger
<h1> <span>word</span> <span>word</span> </h1>
Current:
This ignores how HTML treat whitespace.
<h1><span>word</span><span>word</span></h1>
What version of
@astrojs/compiler
are you using?2.7.1
What package manager are you using?
pnpm
What operating system are you using?
linux
Describe the Bug
compressHTML is removing whitespace that shouldn't be https://github.com/withastro/compiler/issues/815.
There should be space between tags with significant whitespace.
That should become
<h1><span>word</span> <span>word</span></h1>
not<h1><span>word</span><span>word</span></h1>
. Lot of examples like this.html-minifier-terser has
conservativeCollapse
option that show how to do it. Or make everything like<h1> <span>word</span> <span>word</span> </h1>
to be safe and solve this everywhere.Link to Minimal Reproducible Example
https://gitlab.com/wackbyte/astro-compress-html-removes-whitespace