Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

css-minifier: CSS custom properties in @supports cannot remove spaces #2020

Closed
yisibl opened this issue Feb 16, 2022 · 2 comments
Closed

css-minifier: CSS custom properties in @supports cannot remove spaces #2020

yisibl opened this issue Feb 16, 2022 · 2 comments

Comments

@yisibl
Copy link
Contributor

yisibl commented Feb 16, 2022

@supports (--foo:    ) {
      html { background: green; }
}

esbuild --minify output:

@supports (--foo:){html{background:green}}

Expectation

Browser page shows green background.
After compression, keep at least one space after --foo: , otherwise not valid in Chrome.

See also: https://lea.verou.me/2020/10/the-var-space-hack-to-toggle-multiple-values-with-one-custom-property/

@yisibl yisibl changed the title css-minifier: the custom properties in @supports cannot remove spaces css-minifier: CSS custom properties in @supports cannot remove spaces Feb 16, 2022
@evanw
Copy link
Owner

evanw commented Feb 16, 2022

That's strange. Both Firefox and Safari treat these two examples the same while Chrome only respects the first one. I wonder if this is a bug with Chrome or with both Firefox and Safari. I'll work on a fix.

@evanw evanw closed this as completed in 9f5e8c8 Feb 16, 2022
@yisibl
Copy link
Contributor Author

yisibl commented Feb 17, 2022

That's strange. Both Firefox and Safari treat these two examples the same while Chrome only respects the first one. I wonder if this is a bug with Chrome or with both Firefox and Safari. I'll work on a fix.

Waiting for answers from CSS experts: https://twitter.com/yisibl/status/1494143919441195011

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

No branches or pull requests

2 participants