-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect/unexpected output for $dimension
token types when using DTCG format spec
#1398
Comments
I think the
In v5, we will likely stop supporting outdated versions of the DTCG spec (color type will get an update in the spec soon as well). |
This probably could be picked up by outside contributors as well just FYI, it shouldn't be too difficult from my estimation, so I added good first issue label |
@jorenbroekema for clarification, when you say "find a way to do this in a non-breaking manner" do you mean both {
"size": {
"$type": "dimension",
"border": {
"width": {
"$value": "1px"
"$description": "Default border width."
}
}
}
} and {
"size": {
"$type": "dimension",
"border": {
"width": {
"$value": {
"value": 1,
"unit": "px"
},
"$description": "Default border width."
}
}
}
} from the examples should produce --pgn-size-border-width: 1px; /* Default border width. */ or do you mean that there should also be a way to produce --pgn-size-border-width-value: 1; /* Default border width. */
--pgn-size-border-width-unit: 0px; /* Default border width. */ from {
"size": {
"$type": "dimension",
"border": {
"width": {
"$value": {
"value": 1,
"unit": "px"
},
"$description": "Default border width."
}
}
}
} |
The former: --pgn-size-border-width: 1px; /* Default border width. */ The latter can be produced as well already, if you use |
According to the DTCG format spec, the
$dimension
token type (source) should have a$value
that:From the DTCG spec example:
When trying this syntax for
$dimension
tokens in style-dictionary v4, we're seeing the following output:Token definition:
Token output in CSS variables
(Includes a
pgn
prefix).I believe the expected CSS variables output should be:
Our current workaround is to define the token with a
$value
that combines thevalue
/unit
together, e.g.:It seems like style-dictionary's support for composite tokens (per the DTCG format spec) is causing
$dimension
tokens to output multiple variables (i.e., splitting the value from the unit) vs. outputting a single CSS variable combining the configuredvalue
/unit
.Is this by design or is there a potential bug when trying to adopt the DTCG spec for
$dimension
tokens? Thanks!The text was updated successfully, but these errors were encountered: