Open dstaley opened 1 year ago
I'm not sure I understand why your "include" tokens source files contain design tokens that already contain the metadata props that style-dictionary is supposed to fill out for you. That said, I will file this as a bug because style-dictionary is supposed to set the isSource property itself whether it's already been prefilled or not.
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
When passing tokens via
include
that contain the propertyisSource: true
, the included tokens are indistinguishable from actual source tokens, resulting in the inability to distinguish during afilter
.Reproduction
Expected result:
build/figma/figma.tokens.json
contains only theblue-500
token since it's defined intokens/color.js
Actual result: output contains tokens from both
tokens/color.js
andinclude/tokens.json
According to the v3 migration guide:
Since the default
json
formatter includes theisSource
property, I think it would make sense to give it special treatment when it's seen in a file coming frominclude
and manually override it tofalse
.