lukasoppermann / design-tokens

🎨 Figma plugin to export design tokens to json in an amazon style dictionary compatible format.
https://www.figma.com/community/plugin/888356646278934516/Design-Tokens
MIT License
971 stars 134 forks source link

Variable modes are not added if the collection name is uppercase in figma. #282

Closed KodinManiac closed 1 year ago

KodinManiac commented 1 year ago

If the collection name in figma is uppercase for example 'Primitives', this breaks the code as it tries to do a replace of the string where one is lower cased and the search string is upper cased.

  1. This can be reproduced by creating a collection with variables that has more than once modes (the collection name must be uppercased).
  2. Create a new collection, set the variable values to references from the collection created from the previous step.
  3. export design token.
  4. inspect the json file for variable references to see if modes are includes.

N.B. This applies to cases where multiple modes are present in the design system, and reference mode is set to true.

a temporary workaround is to rename collections to lower-case in figma.

I had checked out the code and made the necessary change i will attach a PR for the fix.

https://github.com/lukasoppermann/design-tokens/pull/281