-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
The JSON is a bit off when exporting variables from Figma. #257
Comments
Hey, the problem is, that we export modes in the name at the moment but not in the reference. Modes don't make sense in a reference but we need them in the names because otherwise we have name duplicates which are not allowed in Json. I am thinking about adding a setting to enable modes in token references for when you only have one mode. I think it is impossible to export multiple files, one for each mode. At the moment you could just remove the mode in the exported Json file by hand. I am on vacation and can't change it. You can also send a PR if you want. Than you can run the dev build of the plugin locally until I can merge and release it. |
@lukasoppermann
Does this mean that if there is only one mode, it would be possible to reference the mode as below? Also, would enabling or disabling this setting be done within the settings modal of the Figma plugin?
|
Yes in the settings of the Figma plugin. Disabling would mean the mode is NOT present in the reference. So your example without mode 1. |
@lukasoppermann |
Not really. It only needs to work in the standard format, the original Format does not export tokens. Feel free to send any questions I can try to answer from my phone. |
@lukasoppermann |
@lukasoppermann Does this mean when referencing a variable that has multiple modes in another variable, that will not be supported? |
Yes. To support multiple modes you need to export them all and afterwards split them somehow. |
In our world we are using the "primordial use case" of modes: light and dark. Our more detailed token references to color will resolve to one of the core colors that is also modal, so for example: download-button-color has a value of "primary" for both modes, light and dark. In turn, primary has a defined hex value for each mode, light and dark. In our case it's obviously necessary to keep the modes in sync, so the designers need to ensure there is a light and dark in both places. So when the code comes across "color-schemes.light.download-button-color" and it points to "color-schemes.primary", in practice our file contains "color-schemes.primary" in a collection that has the same modes (light and dark). Sounds like you are not considering supporting this by having "color-schemes.light.primary" as the alias value for "color-schemes.light.download-button-color" when you say:
Is that correct? |
I am grateful for this plugin. The JSON exported with the settings below may not be as intended.
I tried running
npm run transform-tokens
following the flow below, but it didn't work:https://github.com/lukasoppermann/design-tokens#transforming-tokens-using-amazon-style-dictionary
Error
The part with Elias is written as
But shouldn't it be in the following form?
Is there something wrong with the way I've set it up? I would appreciate it if you could help me.
Exported Json
Plugin Setting
The text was updated successfully, but these errors were encountered: