Skip to content

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

Closed
@yisibl

Description

@yisibl
Contributor
@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/

Activity

changed the title [-]css-minifier: the custom properties in @supports cannot remove spaces[/-] [+]css-minifier: CSS custom properties in @supports cannot remove spaces[/+] on Feb 16, 2022
evanw

evanw commented on Feb 16, 2022

@evanw
Owner

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.

yisibl

yisibl commented on Feb 17, 2022

@yisibl
ContributorAuthor

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

Metadata

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

        Participants

        @evanw@yisibl

        Issue actions

          css-minifier: CSS custom properties in @supports cannot remove spaces · Issue #2020 · evanw/esbuild