-
Notifications
You must be signed in to change notification settings - Fork 293
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: allow globalFontFace
to accept array of font face rules
#1379
feat: allow globalFontFace
to accept array of font face rules
#1379
Conversation
🦋 Changeset detectedLatest commit: 67a27a8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This complements #1114 nicely. We should've done this a while ago. Thanks for the PR!
@askoufis I think this broke something. The css I am seeing generated is this: @font-face {
src: url("/fonts/slussen/Slussen-Black-Italic.otf") format("opentype");
font-weight: 900;
font-style: italic;
font-family: Slussen;
}
@font-face {
0 {
src: url("/fonts/slussen/Slussen-Black.otf") format("opentype");
font-weight: 900;
font-style: normal;
}
1 {
src: url("/fonts/slussen/Slussen-Bold-Italic.otf") format("opentype");
font-weight: bold;
font-style: italic;
}
2 {
src: url("/fonts/slussen/Slussen-Bold.otf") format("opentype");
font-weight: bold;
font-style: normal;
}
3 {
src: url("/fonts/slussen/Slussen-Light-Italic.otf") format("opentype");
font-weight: 300;
font-style: italic;
}
4 {
src: url("/fonts/slussen/Slussen-Light.otf") format("opentype");
font-weight: 300;
font-style: normal;
}
5 {
src: url("/fonts/slussen/Slussen-Medium-Italic.otf") format("opentype");
font-weight: 500;
font-style: italic;
}
6 {
src: url("/fonts/slussen/Slussen-Medium.otf") format("opentype");
font-weight: 500;
font-style: normal;
}
7 {
src: url("/fonts/slussen/Slussen-Regular-Italic.otf") format("opentype");
font-weight: normal;
font-style: italic;
}
8 {
src: url("/fonts/slussen/Slussen-Regular.otf") format("opentype");
font-weight: normal;
font-style: normal;
}
9 {
src: url("/fonts/slussen/Slussen-Semibold-Italic.otf") format("opentype");
font-weight: 600;
font-style: italic;
}
10 {
src: url("/fonts/slussen/Slussen-Semibold.otf") format("opentype");
font-weight: 600;
font-style: normal;
}
11 {
src: url("/fonts/slussen/Slussen-Thin-Italic.otf") format("opentype");
font-weight: 100;
font-style: italic;
}
12 {
src: url("/fonts/slussen/Slussen-Thin.otf") format("opentype");
font-weight: 100;
font-style: normal;
}
font-family: Slussen;
} for this vanilla extract snippet: globalFontFace(slussen,
{
src: 'url("/fonts/slussen/Slussen-Black-Italic.otf") format("opentype")',
fontWeight: '900',
fontStyle: 'italic'
},
)
globalFontFace(slussen, [
{
src: 'url("/fonts/slussen/Slussen-Black.otf") format("opentype")',
fontWeight: '900',
fontStyle: 'normal'
},
{
src: 'url("/fonts/slussen/Slussen-Bold-Italic.otf") format("opentype")',
fontWeight: 'bold',
fontStyle: 'italic'
},
{
src: 'url("/fonts/slussen/Slussen-Bold.otf") format("opentype")',
fontWeight: 'bold',
fontStyle: 'normal'
},
{
src: 'url("/fonts/slussen/Slussen-Light-Italic.otf") format("opentype")',
fontWeight: '300',
fontStyle: 'italic'
},
{
src: 'url("/fonts/slussen/Slussen-Light.otf") format("opentype")',
fontWeight: '300',
fontStyle: 'normal'
},
{
src: 'url("/fonts/slussen/Slussen-Medium-Italic.otf") format("opentype")',
fontWeight: '500',
fontStyle: 'italic'
},
{
src: 'url("/fonts/slussen/Slussen-Medium.otf") format("opentype")',
fontWeight: '500',
fontStyle: 'normal'
},
{
src: 'url("/fonts/slussen/Slussen-Regular-Italic.otf") format("opentype")',
fontWeight: 'normal',
fontStyle: 'italic'
},
{
src: 'url("/fonts/slussen/Slussen-Regular.otf") format("opentype")',
fontWeight: 'normal',
fontStyle: 'normal'
},
{
src: 'url("/fonts/slussen/Slussen-Semibold-Italic.otf") format("opentype")',
fontWeight: '600',
fontStyle: 'italic'
},
{
src: 'url("/fonts/slussen/Slussen-Semibold.otf") format("opentype")',
fontWeight: '600',
fontStyle: 'normal'
},
{
src: 'url("/fonts/slussen/Slussen-Thin-Italic.otf") format("opentype")',
fontWeight: '100',
fontStyle: 'italic'
},
{
src: 'url("/fonts/slussen/Slussen-Thin.otf") format("opentype")',
fontWeight: '100',
fontStyle: 'normal'
},
]); |
Oh sorry, I see this was only merged last week, and hasn't officially been released! The docs are updated though so it confused me. |
For anyone else coming across this you can fix temporarily like so: [
{
src: 'url("/fonts/slussen/Slussen-Thin.otf") format("opentype")',
fontWeight: '100',
fontStyle: 'normal'
},
...
].map((ff) => {
globalFontFace(slussen, ff)
}) |
@JonathanLorimer I was planning to release this feature alongside some other changes, but they haven't been merged yet. I've just done a release, so this feature is now available in |
This PR adds support to
globalFontFace
function to accept an array of font face rules.example:
If you need any additional documentation or clarification, please let me know.
Thank you!