Skip to content

mergeLonghand lowercases values with multiple var references #847

@lojjic

Description

@lojjic

This could be considered a reopening of #648, or a bug with the implemented fix in #649. That did fix simple cases but it still fails when values contain more than a single var(--X) reference. An example:

border: 1px solid hsla(var(--HUE), var(--SATURATION), var(--LUMINANCE), 0.5)

incorrectly transforms to:

border: 1px solid hsla(var(--hue), var(--saturation), var(--LUMINANCE), 0.5)

The culprit appears to be the greedy leading .* in the regular expression at

const varRE = /(^.*var)(.*\(.*--.*\))(.*)/i;

This toLower logic could probably be fixed to handle strings with multiple vars. However, I'd question whether lowercasing should be happening in parseWsc.js at all. I feel like the mergeLonghand plugin should be limiting itself to only merging, and leave lowercasing up to other specialized plugins that can handle that in a more robust way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions