by theandrewbailey · 4y ago · 0 comments
Yeah, you can definitely go overboard with webfonts. The 3 that my blog[0] uses are base64 URLs in my single 100k CSS file.
Reducing javascript and deferring the rest gets some solid speedups.
Serving everything from a single domain reduces total load time, due to DNS lookups.
You might even get away with not having social media widget JS, too: https://www.hanselman.com/blog/add-social-sharing-links-to-y...
This is not an efficient approach. Base64 will make the fonts about 30% bigger, and webfonts are already too big. The fact that it's in CSS also means that it's now render blocking, and font-display can't be used.
You're likely delaying your render time versus standard font loading. Do a comparison in WebPageTest and examine the waterfall.
Does this actually change the transmitted size significantly?
100KB for a font is a lot of data on a website. I'm using a custom subsetted version of Source Sans Pro at just 6.7KB.
The user has a default font, who am I to say that I know a better one?
If you want to be more pragmatic you can accept that most browsers use awful fonts by default. However coming soon is system-ui, ui-serif and ui-sans-serif which allow you to let the user to continue picking the font, expect not awful.
(I still don't understand why browser didn't just update initial, serif and sans-serif to be non-awful, but I'm not a browser maker)