tokens-studio / sd-transforms

Custom transforms for Style-Dictionary, to work with Design Tokens that are exported from Tokens Studio
MIT License
175 stars 27 forks source link

[Feature]: Provide access to original type #291

Closed patrickgalbraith closed 3 weeks ago

patrickgalbraith commented 3 weeks ago

What feature would you like?

The alignTypes function in the preprocessor overwrites the type (see https://github.com/tokens-studio/sd-transforms/blob/main/src/preprocessors/align-types.ts). It would be useful to get access to the original token studio type somehow. Currently we work around this by creating a preprocessor that runs before the token studio one and adds a originalTsType property.

Would you be available to contribute this feature?

jorenbroekema commented 3 weeks ago

I think this makes sense yes, perhaps put it inside the $extensions.studio.tokens namespace since it's vendor-specific metadata. Feel free to raise a PR!

jorenbroekema commented 3 weeks ago

Actually I'll handle this PR, this one is somewhat coupled to another fix I'm doing for types alignments, and adding props to the studio.tokens $extensions namespace requires changes to @tokens-studio/types package as well.

Edit: labelling as bug as well because it's related to the bug that not all types are aligned, and if we do and letterSpacing is aligned to "dimension", then the letterSpacing transform no longer applies to those tokens, which is a bug imo and warrants storing the originalType and matching that for this transform.

patrickgalbraith commented 3 weeks ago

@jorenbroekema no worries thanks for the fast response!