-
Notifications
You must be signed in to change notification settings - Fork 29
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
Math resolve not done on expressions with inconsistent spacing #251
Comments
Confirmed bug, minimal reproduction here. To work around this issue, place ensure that your math operations either don't contain any spaces, or consistently have 1 space before and after operators (like I'll try to fix this but our resolve math utility is a little bit fragile given that we also need to support multi-value tokens, which also happen to use space as separator, this makes the string interpolation we have to do to support both of these features really complicated. I can't guarantee that I'll find a fix 😓 |
Oh, I see it. It works with fixed spaces! But the main question was about "Custom transforms leads to incorrect variables names" tokens JSON
Builder script
Compiles to:
I want to transform these numbers to pixels, so change code of my builder to
And the output is:
So, the name-folding is lost. What I am doing wrong? |
If you use a custom transform group, you'll also need to add a custom name transform e.g. StyleDictionary.registerTransformGroup({
name: "custom/tokens-studio",
transforms: [...transforms, "name/cti/kebab", "numbersToPx"],
}); |
Hello
Here is my tokens example
https://codesandbox.io/p/devbox/figma-tokens-8p8ycw
I have few challanges from designers:
{borderRadiusDefault} * {badge.sizeSM} / {controlSizeMD}
for border-radiuses, which compiles to something like this48px /2 * 64px / 48px
. So I nee to wrap some tokens values in tocalc()
--sdShadowXSm: 0;
. So I have to usetransformDimension
for that tokens.Default build script works fine, but can not solve my problems.
When I tried to write custom transformers (build-tokens.mjs:10), like in commented code in my sandbox, variables naming brokes
For example:
--sdShadowXSm: 0;
- before transformation--xs: 2px;
- after transformationCan`t understand what I am doing wrong. And how can I do custom transformations and keep variables names safe.
Appreciate your help!
The text was updated successfully, but these errors were encountered: