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

Request for New Output Format: JSON #93

Closed CodeByAlex closed 3 years ago

CodeByAlex commented 3 years ago

Is your feature request related to a problem? Please describe. I think it would be great if this tool could output the tokens as JSON so that they could be injected by other tools such as Style Dictionary by amazon.

Describe the solution you'd like During the token creation process, when js/ts is generated, json could also be an output option using the same naming.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered. converting the js to json on the consumer side

Additional context Add any other context or screenshots about the feature request here.

mikaelvesavuori commented 3 years ago

Hi @CodeByAlex,

This feature was added to version 4.0.12 which just got released.

You either set "outputFormatTokens": "json" in .figmagicrc or pass --outputFormatTokens json when you call Figmagic on the command line. The result is going to be exactly what the regular TS/JS tokens look like, but without the warning on the first line. You will also not get the export statement.

If this is something I can improve, you're free to give some pointers.

Another option would be using outputDataTypeTokens and setting it to enum which is similar, but admittedly not identical. However, changes seem to have broken that functionality. I've put a private note on looking at that when I get time.