Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add useLiteralFontFamilies option #174

Merged

Conversation

opauloh
Copy link
Contributor

@opauloh opauloh commented Oct 12, 2022

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

  • added useLiteralFontFamilies option
  • updated CLI parser and RC file
  • updated docs with useLiteralFontFamilies option and examples
  • added test cases for useLiteralFontFamilies

Screenshots

Example of how it would like in Figma

image

Example of how it would like in code:

image

Checklist

  • I have read the Figmagic Contribution Guideline
  • The PR title summarizes the change

@sonarcloud
Copy link

sonarcloud bot commented Oct 12, 2022

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 mikaelvesavuori self-assigned this Oct 12, 2022
@mikaelvesavuori mikaelvesavuori added the enhancement New feature or request label Oct 12, 2022
@mikaelvesavuori
Copy link
Owner

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

Copy link
Owner

@mikaelvesavuori mikaelvesavuori left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@mikaelvesavuori mikaelvesavuori merged commit bac3831 into mikaelvesavuori:main Oct 12, 2022
@mikaelvesavuori
Copy link
Owner

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

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

@opauloh
Copy link
Contributor Author

opauloh commented Oct 12, 2022

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

@opauloh opauloh deleted the feature/useLiteralFontFamilies branch October 12, 2022 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants