Thanks for the suggestion! I’ve put it on my todo list!
Thread Starter
Rookie
(@alriksson)
Sorry for the late reply, didn’t get notifications on your response here. So 2 months later any news on this where are we at? 😀
Thread Starter
Rookie
(@alriksson)
@daanvandenbergh Did you see my reply?
Thread Starter
Rookie
(@alriksson)
@daanvandenbergh Any chance you could include this? 🙂
Hi again,
Why would you preload all fonts? You should only preload fonts that’re used above the fold.
Also, reconsidering, I’m not sure I see the added value of this. Preloading already adds a priority to files compared to files that aren’t preloaded. And since you should limit font usage, preloading files should be limited even more.
So, I think you came up with a solution to a problem, that shouldn’t even be a problem when the preload option is used properly.
Correct me if I’m wrong.
Thread Starter
Rookie
(@alriksson)
I do preload 3 out of 5 woff2 files. But for some reason, browsers load the non preloaded woff2 file with the highest priority. I assumed this is due to the order the woff2 files appear and are referred in the stylesheet. But 400 italic is not no 1 and is not used above the fold.
I’ve not manipulated the stylesheet manually myself to test, but on the spot this is the only reason I see why the browser would prioritize this one.
As you say preloading only the prioritized fonts is what I do meaning excluding one for example 400 italic. But it has the highest priority in the browser once it renders the pages.
And I would not preload all fonts I would add priority hints as well. For example, to make sure the non preloaded font is getting the highest priority I would add low. Right now, priority hints is only supported in the latest versions of Chrome, but it will be coming. Doesn’t hurt to add other browsers would just ignore it.
But I would look into why the non preloaded fonts get high priority? What I do is I inline the additional font stylesheet and the order is:
font-style: normal;
font-weight: 400;
font-display: swap;
font-style: italic;
font-weight: 400;
font-display: swap;
font-style: normal;
font-weight: 700;
font-display: swap;
font-style: italic;
font-weight: 700;
font-display: swap;
font-style: normal;
font-weight: 900;
font-display: swap;
Any idea? What I can see is preloaded resources get priority high, while the two non preloaded italic get priority highest.
Hey!
Finally had some time to look into this. About the implementation of a fetchpriority attribute, I was thinking:
- Allow to set a fetchpriority attribute per stylesheet, but then what?
- If that fetchpriority is lower than ‘highest’, don’t allow preloads of that stylesheet maybe?
- Or should that fetchpriority be set to all preloads defined in that stylesheet?