design-tokens / community-group

This is the official DTCG repository for the design tokens specification.
https://tr.designtokens.org
Other
1.56k stars 63 forks source link

Leading/trailing white space in token names. #194

Open romainmenke opened 1 year ago

romainmenke commented 1 year ago
{
  "  foo  ": { "$type": "color", "$value": "#ff00ff" }
}

Token names are not defined in a similar way as ident tokens are in CSS, identifiers in JavaScipt, ... There are no characters that indicate the start or end of a token name.

This implies that token names are defined by an "outside" boundary. In the example above the token name is defined by the double quotes of the JSON string.

In this example the token name is defined by the enclosing curly braces :

{
  "bar": { "$value": "{  foo  }" }
}

These examples are a bit forced, but a lone trailing space is more common :

This in turn can be confusing for users of these tokens because the visible name doesn't match the actual name.