google-fonts
google-fonts copied to clipboard
Subsets parameter and download
Due to the recent changes in Chrome's cache partitioning, I wanted to use the download mode.
My config:
buildModules: [ [ "@nuxtjs/google-fonts", { families: { Sarabun: { wght: [400, 700] } }, subsets: ['latin'], download: true } ] ]
But the result is unexpected:

Am I missing something? Tried deleting both folders to redownload. Same result.
Same here! With the following config just the first font (Montserrat) gets downloaded but including all subsets instead of just latin:
googleFonts: { families: { Montserrat: [400, 700], Roboto: 400, Sanchez: true }, subsets: 'latin', display: 'swap', download: true }
Hi @galaczi, @derteaser
Google fonts uses your browser based to know which fonts it will download.
This module uses under the hood the google-fonts-helper which defines the default user-agent. https://github.com/ricardogobbosouza/google-fonts-helper/blob/master/src/index.ts#L104
We need to document the headers option in the download area, but you can customize it as you see fit.
We need to document the
headersoption in the download area, but you can customize it as you see fit.
Thanks for the input, how one could modify the headers option to only take latin or other subsets ?
Subsets and wght are not working with download: true:
googleFonts: {
display: 'swap',
download: true,
families: {
Roboto: {
wght: [300, 700]
}
},
subsets: 'latin'
},
I am getting:
@font-face {
font-family: Roboto;
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(/_nuxt/fonts/Roboto-400-cyrillic-ext1.493afe7.woff2) format("woff2");
unicode-range: U+0460-052f, U+1c80-1c88, U+20b4, U+2de0-2dff, U+a640-a69f, U+fe2e-fe2f;
}
@font-face {
font-family: Roboto;
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(/_nuxt/fonts/Roboto-400-cyrillic2.5e49381.woff2) format("woff2");
unicode-range: U+0400-045f, U+0490-0491, U+04b0-04b1, U+2116;
}
...
Same issue here, Haven't specified any subsets, Still downloading all subsets
Still happening.
Soon I will release the new version of google-fonts-helper will fix this problem
It is worth remembering that when using subsets automatically or the module uses google fonts v1 which does not allow you to define some fonts weights
See https://developers.google.com/fonts/docs/getting_started https://developers.google.com/fonts/docs/css2
Still happening.
Also, if we can't use subsets with weights, that seems bad.
Please try v3.0.0-1
If the problem persists, please reopen
@ricardogobbosouza this issue still occurs, even on the last version, subset + fw doesn't work at all