patternfly / design-tokens

MIT License
1 stars 8 forks source link

Add Figma export plugin #6

Closed mfrances17 closed 11 months ago

mfrances17 commented 12 months ago

Closes https://github.com/patternfly/design-tokens/issues/2.

This Figma plugin will export the variables out of Figma and separate them into JSON files that can be used by the style dictionary process. It's all written in vanilla JS. My goal for this pass of the plugin was to produce the exact JSON files that we are consuming now, without the manual effort.

See README.md for complete instructions on how to install/use so it can be tested.

Refactoring/future work

mfrances17 commented 11 months ago
  • Could this be renamed to something more like Export PatternFly Tokens? It's pretty specific to PatternFly.

Yep, definitely can be renamed to anything we want.

  • Would it be possible to further automate downloading the files? At a minimum, it would be nice to separate the list into files for the base folder and files for the dark folder.

So, the problem here is that I encountered many issues trying to save files to disk using javascript via a browser. The solution I eventually went with would actually do it but because the browser needs to prompt the user with the download modal (and I can't get that handle), the code will fail because it outpaces the ability to click/dismiss the dialog. Even with sleeps and promises.

The other possible solution I considered was to import something like the jszip library and create the files and folder structure within a zip and have the user download one zipped file. I personally preferred using the individual links because maybe the user changed just a subset, but that was just my opinion and we can go that route if it's preferred.

srambach commented 11 months ago

BTW, your instructions are great! Nice job.

nicolethoen commented 11 months ago

+1 instructions are great! it looks like it all worked for me :)

srambach commented 11 months ago
  • Could this be renamed to something more like Export PatternFly Tokens? It's pretty specific to PatternFly.

Yep, definitely can be renamed to anything we want. Great - so Export PatternFly Tokens?

mfrances17 commented 11 months ago

@srambach i renamed the plugin to Export Patternfly Tokens, changed all refs/resources/docs accordingly, and retested... should be good

github-actions[bot] commented 9 months ago

:tada: This PR is included in version 1.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: