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
953 stars 131 forks source link

Number variables are being exported with incorrect values #264

Closed atlas-ui closed 1 year ago

atlas-ui commented 1 year ago

Hi!

Noticed a funky bug with a recent export of Figma variables where certain rational numbers are exporting as non-rational.

Here is a screenshot of the tokens in Figma Variables as expected:

Screenshot 2023-08-10 at 2 16 22 PM

Below is the json output, see number-3 and number-4:

{
  "testing": {
    "mode 1": {
      "number-1": {
        "type": "size",
        "value": 1,
        "extensions": {
          "org.lukasoppermann.figmaDesignTokens": {
            "mode": "Mode 1",
            "collection": "Testing",
            "scopes": [
              "ALL_SCOPES"
            ],
            "variableId": "VariableID:11014:71479",
            "exportKey": "variables"
          }
        }
      },
      "number-2": {
        "type": "size",
        "value": 1.25,
        "extensions": {
          "org.lukasoppermann.figmaDesignTokens": {
            "mode": "Mode 1",
            "collection": "Testing",
            "scopes": [
              "ALL_SCOPES"
            ],
            "variableId": "VariableID:11014:71480",
            "exportKey": "variables"
          }
        }
      },
      "number-3": {
        "type": "size",
        "value": 1.7799999713897705,
        "extensions": {
          "org.lukasoppermann.figmaDesignTokens": {
            "mode": "Mode 1",
            "collection": "Testing",
            "scopes": [
              "ALL_SCOPES"
            ],
            "variableId": "VariableID:11014:71481",
            "exportKey": "variables"
          }
        }
      },
      "number-4": {
        "type": "size",
        "value": 2.3299999237060547,
        "extensions": {
          "org.lukasoppermann.figmaDesignTokens": {
            "mode": "Mode 1",
            "collection": "Testing",
            "scopes": [
              "ALL_SCOPES"
            ],
            "variableId": "VariableID:11014:71482",
            "exportKey": "variables"
          }
        }
      }
    }
  }
}
lukasoppermann commented 1 year ago

Should be fixed, this is an issue with how figma handles those values.