Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.

Conversation

calebdwilliams
Copy link
Contributor

This pull request provides a fix for #208 Custom Property as Fallback for Custom Property
.

Existing behavior

Currently the library only parses one level of the custom property tree to set a fallback value, so the

:root {
  --primary: tomato;
}
.rule {
  color: var(--override, var(--primary));
}

will yield

:root {
  --primary: tomato;
}
.rule {
  color: var(--primary);
  color: var(--override, var(--primary));
}

New behavior

The above example will now yield

:root {
  --primary: tomato;
}
.rule {
  color: tomato;
  color: var(--override, var(--primary));
}

This should work regardless of how many fallbacks are used.

@calebdwilliams
Copy link
Contributor Author

See also #240

@calebdwilliams
Copy link
Contributor Author

@jonathantneal Is there anything else this needs before being merged? My organization's ability to use PostCSS for our purposes kind of hinges on this functionality.

@jonathantneal jonathantneal merged commit 3b23497 into postcss:master Jun 15, 2021
@jonathantneal
Copy link
Member

Fantastic work, @calebdwilliams. Thank you!

@calebdwilliams calebdwilliams deleted the fix/custom-prop-fallback branch June 15, 2021 03:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants