amzn / style-dictionary

A build system for creating cross-platform styles.
https://styledictionary.com
Apache License 2.0
3.87k stars 543 forks source link

Put SD specific metadata in $extensions #1175

Closed jorenbroekema closed 4 months ago

jorenbroekema commented 5 months ago

I think we also need to have a discussion on how metadata properties should be handled in general. According to the DTCG spec, you'd put it either in property names starting with $ prefix, or you'd put it into the $extensions under the unique namespace of your tool (e.g. style-dictionary). If I'm not mistaken, $metada props are something that belong to the token authors territory, and $extensions is where tools can put their stuff, so I'm leaning towards refactoring everything to scope and read metadata from that $extensions['com.styledictionary'] namespace

Originally posted by @jorenbroekema in https://github.com/amzn/style-dictionary/issues/1007#issuecomment-2088820398

jorenbroekema commented 4 months ago

In hindsight, this isn't a priority since we only add metadata internally in the dictionary object on the token level (path, filePath and so on), and on the token level the list of properties is either known or using $ prefixes if user is adding more props, as opposed to in token group level where you can have any property key to indicate a nested token group or token. So there shouldn't be any issues with property collisions.