DEV Community

Discussion on: Is using a CDN or hosting your own Fonts a better idea?

Collapse
 
ahferroin7 profile image
Austin S. Hemmelgarn

Arguments in favor of hosting your own assets:

  • You can actually do custom versions of the assets. Bootstrap is probably the best example of this, as Bootstrap 4 pretty much requires you to have your own custom version of the CSS if you want a custom theme (and it looks like this probably won't change in Bootstrap 5, but might in Bootstrap 6 if they finally start using custom properties).
  • You aren't dependent on external infrastructure. Remember what happened recently when CloudFlare had issues?
  • You don't have to worry about leaking customer information to external sources. This sounds stupid, but may matter in some cases.
  • You can easily develop your site offline. You might be able to do this still with a CDN, but you have to be lucky for it to work, and also have to remember not to use a hard refresh.

Arguments in favor of using CDN-hosted assets:

  • If it's a common asset, the client system may avoid making a network request.
  • Even if it's not a common asset, it's less disk space and network bandwidth needed for your server.

Also, note that both arguments favoring CDN hosting become a bit weaker if you're doing a PWA and your Service Worker is sanely handling the caching.