Expand variables in AtRule properties #104
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As written, this plugin makes the seemingly reasonable assumption that all variable expansions will happen inside of a CSS Rule (that is, a set of Properties scoped to one or more Selectors).
However, some CSS At-Rules (like
@font-face
and@page
) allow for CSS Properties to be their direct descendants. These are philosophically a little trickier to implement, since (e.g.) the@page
[At-]Rule doesn't actually appear in the DOM hierarchy, but not permitting At-Rules to use variables limits their utility and forces duplication of variable values.For such cases, there is a simple, sensible interpretation that extends naturally:
:root
implies the set of "global" variables, and the expectation is that At-Rules would have access to variables defined in that scope. Variables defined in lower scopes should (obviously) not have an effect on such high-level [At-]Rules – and the existing behaviors for At-Rule-scoped Rules seem adequate for describing the cases where both an At-Rule and a lower-scoped variable need to coordinate.