mikaelvesavuori / figmagic

Figmagic is the missing piece between DevOps and design: Generate design tokens, export graphics, and extract design token-driven React components from your Figma documents.
https://docs.figmagic.com
MIT License
807 stars 71 forks source link

Unit configuration option for borderWidths, radii and shadows #145

Closed alehar9320 closed 2 years ago

alehar9320 commented 2 years ago

Problem statement I'm attempting to change the unit of all figmagictokens from px to rem and get frustrated by the lack of configuration options.

Describe the solution you'd like I'd like the possibility of changing each figmagic token category individually. Currently, Figmagic lacks the options for borderWidths, radii and shadows.

Describe alternatives you've considered Manually converting them, post Figmagic has run, using the same base unit as set in Figmagic's configuration file (figmagic.json).

Additional context Whether the web dev community consensus is to move towards the adoption of rem for the above-mentioned categories should be besides the point, if the unit configuration option exists for some categories, it should be there for all.

I do however still welcome discussions on the pros and cons of using rems for each and every category. At the heart of it, rems do make sense whenever the content seeks to be responsive. Perhaps it should be the future default of Figmagic (even though Figma doesn't support anything other than px yet).

mikaelvesavuori commented 2 years ago

Hi! I might be able to add this during the weekend.

mikaelvesavuori commented 2 years ago

You are of course also welcome to make your own pull request, if you have the time!

mikaelvesavuori commented 2 years ago

I got less time than needed, but now it's just really the radii that's left needing a fix (that solution uses normalizeUnits() which requires a somewhat different approach on my end).

mikaelvesavuori commented 2 years ago

This is now done, and I'll be releasing it in 4.3.6 shortly.