Skip to content

esbuild breaks font:16px"Menlo" when minifying #3452

Closed
@unilynx

Description

Given the following CSS

.testfontrewrite {
  font: 9pt/16px"Menlo";
}

esbuild 0.19.4 with minify (esbuild --minify test.css) will output

.testfontrewrite{font:9pt/16pxMenlo}

Stripping the quotes around Menlo and breaking the font declaration

(this started after I updated csstree from 1.x to 2.x which removed the whitespace)

I'm no expert on CSS parsing... Reading https://www.w3.org/TR/css-syntax-3/#consume-token I think a quote should trigger a separate string token, even without spaces. Browers tolerate it too, so I think csstree 2 is correct in doing this, and esbuild shouldn't strip the quotes (or re-add the space)

If I disable minifying everything works fine. If I'm misinterpreting the CSS parse rules I'll be happy to report the issue to csstree instead :-)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions