postcss-custom-properties icon indicating copy to clipboard operation
postcss-custom-properties copied to clipboard

Nested custom properties with preserve false does not work correctly

Open Dai7Igarashi opened this issue 4 years ago • 1 comments

In fallback pattern using "preserve: false", custom properties remain and "root" is deleted, so it can't check the custom properties like below.

[preserve: false]

▼ before
:root {
  --my-blue: blue;
}

// "--my-red" does not exist
.sample {
  color: var(--my-red, var(--my-blue))
}

▼ after
.sample {
  color: var(--my-blue) <-- can't resolve the custom properties
}

if "preserve: true", it's ok.

[preserve: true]

▼ before
:root {
  --my-blue: blue;
}

// "--my-red" does not exist
.sample {
  color: var(--my-red, var(--my-blue))
}

▼ after
:root {
  --my-blue: blue;
}
.sample {
  color: var(--my-blue) <-- it can resolve the custom properties
}

Dai7Igarashi avatar Nov 18 '20 08:11 Dai7Igarashi

Upvote this issue

msereniti avatar Jan 28 '22 09:01 msereniti