tokens-studio / sd-transforms

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

fix: evaluate math expressions with units #304

Closed Sese-Schneider closed 1 month ago

Sese-Schneider commented 1 month ago

A recent PR (https://github.com/tokens-studio/sd-transforms/pull/49) broke the ability to evaluate math expressions with units.

roundTo(30px/5)

This PR changes the order of operations, so that both eval-expr and postcss-calc-ast-parser are applied to the expression without any units. Furthermore I added some additional checks to increase the speed of the evaluation function.

changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: 4ff42feb658f2a8cfa935b52ecb4cac83cae3288

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---------------------------- | ----- | | @tokens-studio/sd-transforms | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

jorenbroekema commented 1 month ago

Oh nice thanks for contributing this! Tests are passing and code looks alright but it's my day off today so I'll check this more thoroughly tomorrow morning with fresh eyes :)