![]() If it is a static asset (where you can use SRI) then self-host, and if it is not static (because the contents are liable to change) then you can't use SRI. Yes there is SRI but that can cause unexpected issues, and I honestly don't see the point. This is not to mention the security implications of loading assets from another domain. All too often you see the main domain serving the index.html, and then that connection not being used for anything else as time is instead wasted setting up new connections. I've been convinced for a while now that third-party CDNs, or even sharding your own domains, are not the performance boast they are thought to be. And recent legislation means a lot of sites have to explicitly list all the cookies used on the site, which gets more complicated when using a third-party. You have no idea what sort of tracking they are doing to your users by using them, rather than self-hosting. That leads nicely into the privacy implications of using third-party CDNs. Additionally Safari has a unique HTTP cache per domain visited, for privacy reasons (called a double-keyed cache) and Chrome soon will have too, ending any argument there. ![]() ![]() There are so many libraries and versions, and browser caches are smaller than you think, so for you to be lucky enough to gain from this seems unlikely. The other supposed benefit of using a public CDN, was from leveraging the fact that visitors might already have that version of jQuery loaded in their HTTP cache, but again I'm convinced that's over-egged. However, it has the same connection issues so again this is not the performance benefits it may once have had. ) so again the fonts are not hosted on your main domain where your web page is loaded from. Additionally HTTP/2 actually benefits from one connection (mostly!) so using other domains is often a performance cost rather than gain.Īnother way of doing this was by sharding your domain with one or more assets subdomain (e.g. While that may have been true in the past (particularly when browsers limited it to less than 6 domains) and before HTTPS became the norm, now connections are expensive to create. The theory behind this was that browsers limited the number of connections to each domain (typically to 6 connections) so using another domain gave you 6 more connections. To be clear when I say CDN here, I mean where you are loading some assets from someone else's domain, rather than a CDN fronting your domain. jQuery from - and yes jQuery is still very much a thing!). So let's look at what we can do to minimise the performance impact, but also give the designers what they want - win win! Self-Hosting assets versus Third-Party hostingĪ few years back it was all the rage to use a CDN to serve common assets (e.g. Still, many feel differently, and fonts are here, whether I appreciate them or not, and many developers aren't given a choice whether to use them or not. However, I've also been acutely aware of the performance implications of them so maybe that's clouded my view of them. Sure they look a bit nicer, and can understand they make a message seem more on-brand, but for the main body of text at least they seem more of a nice to have - I've never read an article more or less (or treated the contents any differently) because it had a pretty font. I'm much more practical than design-y (look at this website for evidence of that!) and have never totally got the need for fonts. Now, to be totally up front, I'll admit that fonts are not my strong point. ![]() Through that I've come up with a more nuanced answer to the question, that in the past I thought was easy: should you self-host Google Fonts? ![]() In the last few weeks, because of a combination of various things at work, and in side-projects, I've been learning a lot about web fonts and also a lot more about Google Fonts specifically. This page was originally created on 1 and last edited on 2. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |