tokens-studio / figma-plugin

Official repository of the plugin 'Tokens Studio for Figma' (Figma Tokens)

Home Page:https://www.figma.com/community/plugin/843461159747178978

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Importing variables leaves internal token properties exposed

six7 opened this issue · comments

When we import variables from Figma we take variables and then store that as tokens. Sometimes we override existing values, if a token already existed. To do that, we use some token keys internally that let us understand what was the old value, and the new. However, it seems we expose these to the user and save back to the JSON.

If I create a Figma variable of type number with a value of 16 and then go to Import variables, the result in JSON looks like this:

{
  "mynumber": {
    "value": "16",
    "type": "number",
    "parent": "Collection 1/Mode 1",
    "description": ""
  }
}

If I then change the variable's value in Figma to 32 and do an Import again, it will look like this:

{
  "mynumber": {
    "value": "32",
    "type": "number",
    "parent": "Collection 1/Mode 1",
    "description": "",
    "oldValue": 16
  }
}

This is a problem, because we expose 2 keys that should be only internal: parent and oldValue. We need to make sure that we strip away those tokens when we import.

Note that this also happens on production.