Skip to content

color-mix is not transpiled after replace var with their color value #943

@Eptagone

Description

@Eptagone

The docs says that Lightning CSS will evaluate color-mixwhen using the color instead of var. That's okey so I make a visitor to replace the var with the actual value and this works but the color transpilation never happens.

See example in playground

I was expecting lightningcss to compile the color like the docs.
See expected transpilation in playground

Input

:root {
  --color-sample: hsl(120deg 10% 20%);
}

.bg-black\/50 {
  background-color: color-mix(in hsl, var(--color-sample) 25%, hsl(30deg 30% 40%));
}

Output

:root {
  --color-sample: #2e382e;
}

.bg-black\/50 {
  background-color: color-mix(in hsl, #2e382e 25.0%, #856647);
}

Expected

:root {
  --color-sample: #2e382e;
}

.bg-black\/50 {
  background-color: #706a43;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions