amzn / style-dictionary

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

Request for Format: MUI #943

Open qweliant opened 1 year ago

qweliant commented 1 year ago

Format Proposal

i, and a few others:

https://github.com/mui/hackathon-figma-plugin/tree/857f5d48aeb108525293fbce490710051260e8d1/src https://github.com/amzn/style-dictionary/issues/927 https://github.com/mui/mui-design-kits/issues/10 https://github.com/mui/mui-design-kits/issues/26#issuecomment-948472476

are trying to solve taking tokens from Figma and making meaningful representations in code by editing some exported token file with regards to MUI specifically.

i believe most are going to find issues with registering the appropriate format for mui typography variables.

some have successfully done this. though with the caveat of needing to register a custom format for MUI. but this is very close to something i would like to do.

As i work on a tokens->code workflow, this all makes me question whether we could get MUI var formats in SD

p.s. I suppose i also question whether this is a slippery slope for SD devs, bc i mean one could just always extend formats(is this true) to support some component library

dbanksdesign commented 1 year ago

Yes you can can extend formats, or any other functionality (transforms, parsers, etc.). I think this would be a really good use-case of building a separate NPM package that exposes the right functionality to take in a tokens file from Figma Tokens and outputs a valid MUI theme. I wrote this RFC a while ago, it works as-is so anyone could write a plugin in this way today: https://github.com/amzn/style-dictionary/issues/311

Also marking this as a duplicate of #927