-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Labels
- P2: has workaroundAn edge case that only affects very specific usage, but has a trivial workaround (priority)An edge case that only affects very specific usage, but has a trivial workaround (priority)ecosystem: upstreamUpstream package has issueUpstream package has issuefeat: assetsRelated to the Assets feature (scope)Related to the Assets feature (scope)
Description
Astro Info
Astro v5.15.9
Node v24.3.0
System macOS (arm64)
Package Manager bun
Output static
Adapter none
Integrations astro-compress
astro-meta-tags
@astrojs/sitemap
astro-critters
pagefind
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I'm specifying a variable font, Raleway in this case, with the Google provider:
{
provider: fontProviders.fontsource(),
name: "Raleway",
cssVariable: "--font-raleway",
weights: ["100 900"],
subsets: ["latin"],
styles: ["normal", "italic"],
}But Astro generates fonts for not only the variable font, but also each individual weight from 100-900 (and both normal and italic):
Show/hide
@font-face {
font-family: Raleway-3d1d3e21de80c672;
src: url("/_astro/fonts/66e05d1899480173.woff2") format("woff2");
font-display: swap;
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
font-weight: 100 900;
font-style: italic;
}
@font-face {
font-family: Raleway-3d1d3e21de80c672;
src: url("/_astro/fonts/1157441d426a7fa6.woff2") format("woff2");
font-display: swap;
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
font-weight: 100 900;
font-style: normal;
}
@font-face {
font-family: Raleway-3d1d3e21de80c672;
src: url("/_astro/fonts/ae605ce102bc84a0.woff") format("woff");
font-display: swap;
font-weight: 100;
font-style: italic;
}
@font-face {
font-family: Raleway-3d1d3e21de80c672;
src: url("/_astro/fonts/418aad49e95b750b.woff") format("woff");
font-display: swap;
font-weight: 200;
font-style: italic;
}
/* ... */I don't know if it's specific to the Google provider, but I tried switching to the Fontsource provider and it didn't have this problem.
What's the expected result?
It should only load the variable font.
Link to Minimal Reproducible Example
Stackblitz didn't work because the Google fonts provider doesn't work because of CORS issues with the WebContainer so I used CodeSandbox.
Participation
- I am willing to submit a pull request for this issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
- P2: has workaroundAn edge case that only affects very specific usage, but has a trivial workaround (priority)An edge case that only affects very specific usage, but has a trivial workaround (priority)ecosystem: upstreamUpstream package has issueUpstream package has issuefeat: assetsRelated to the Assets feature (scope)Related to the Assets feature (scope)