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

feat: add useLiteralFontFamilies option #174

Closed opauloh closed 1 year ago

opauloh commented 1 year ago

Summary

Hey all

At my team's Design System (and also other design systems I've seen around) we provide the Font Family token as the whole font family stack, including the fallbacks in case of missing fonts.

i.e:

const fontFamilies = {
  default: 'Roboto, BlinkMacSystemFont, Helvetica, Arial, sans-serif',
  serif: 'Georgia, Times, Times New Roman, serif',
  code: "'Roboto Mono', Menlo, Courier, mc"
}

Currently using Figmagic we can only grab one font per token, which means we need to add a step for creating a combined token with a token from Figma + the fallbacks, but the problem is that this way we don't have a Single Source of Truth for these particular tokens, since the code is different from what is on Figma.

We found out that it would be helpful if we had an option to do this directly on Figma to keep the Single Source of Truth and have the ability to import using Figmagic and avoid extra steps.

Description of the changes made

Screenshots

Example of how it would like in Figma

image

Example of how it would like in code:

image

Checklist

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

mikaelvesavuori commented 1 year ago

Hi @opauloh! This is great work. Happy to merge this. Will cut a release of this ASAP.

mikaelvesavuori commented 1 year ago

Happy to present 4.5.6 with your work! Beers to you!

https://github.com/mikaelvesavuori/figmagic/releases/tag/v4.5.6

opauloh commented 1 year ago

That's Awesome! Thank you @mikaelvesavuori!!! 🍻