Skip to content

Invalid minification of CSS decalaration using sibling-index() #4515

Description

@chrisjstott

Minifying a CSS declaration where sibling-index() is multiplied by a value with a unit can result in an invalid declaration.

For example: animation-delay: calc(sibling-index() * 0.05s); minifies to animation-delay:calc(sibling-index()/20s), which is invalid because the numerator is unitless and the denominator has a unit.

Minimal test case:

  1. create a css file with this content or clone this repo
div {
  animation-delay: calc(sibling-index() * 0.05s);
}
  1. run esbuild --bundle {css filename} --minify --outfile=out.css or npm run build in the test repo
  2. out.css includes the invalid css value

Activity

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

      Issue actions