Skip to content

Meaningful whitespace collapsed with compressHTML: true #852

@delucis

Description

@delucis

What version of @astrojs/compiler are you using?

1.8.1

What package manager are you using?

npm

What operating system are you using?

macOS / StackBlitz

Describe the Bug

Certain instances of inline whitespace appear to be collapsed with an impact on the visual result when using Astro’s new compressHTML: true config option.

Specifically this seems to be the case with expressions (e.g. {'string'}) and inline elements (e.g. <span> or <time>):

Input

<p>{'text'} <span>text</span></p>
<p><span>text</span> <span>text</span></p>

Actual output

<p>text<span>text</span></p>
<p><span>text</span><span>text</span></p>

Expected output

<p>text <span>text</span></p>
<p><span>text</span> <span>text</span></p>

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-obrxxu?file=src%2Fpages%2Findex.astro

Metadata

Metadata

Assignees

Labels

- P4: importantViolate documented behavior or significantly improves performance (priority)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions