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 variables with same value defined in media query are minified incorrectly #2838

Closed
CLDXiang opened this issue Jan 17, 2023 · 1 comment
Closed

Comments

@CLDXiang
Copy link

esbuild@0.17.0

When two different CSS variables with same value defined in media query, only one of these CSS variables will remain in the minified output.

Input:

@media (prefers-color-scheme: dark) {
  body {
    --VAR-1: #000;
  }
}

@media (prefers-color-scheme: dark) {
  body {
    --VAR-2: #000;
  }
}

esbuild --bundle style.css --outfile=out.css --minify-syntax output:

/* style.css */
@media (prefers-color-scheme: dark) {
  body {
    --VAR-2: #000;
  }
}
@evanw
Copy link
Owner

evanw commented Jan 18, 2023

Thanks for the report. It looks like this is an old regression from version 0.11.19.

Edit: And it was caused by a dumb typo: RulesEqual(a.Rules, a.Rules) instead of RulesEqual(a.Rules, b.Rules).

@evanw evanw closed this as completed in f8c5139 Jan 18, 2023
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