Improve Your Theme’s Performance With jsDelivr

We all know the advantages of using a content delivery network for moving the loading of theme assets off the user’s server and onto an international network of edge nodes, but without control of the server, there is limited scope for developers to take control of exactly where theme assets like JavaScript libraries are served from.

Google’s Hosted Libraries is one way of reducing the burden of included JavaScript files. GHL offers hosting for many of the most popular open-source JavaScript libraries, including jQuery, AngularJS, and Dojo, but the selection is far from comprehensive. There are dozens of nifty JS libraries that a developer might want to include, but that they may be tempted to avoid for fear of loading themes up with files that degrade performance.

jsDelivr plugin

jsDelivr is a nifty solution to the problem of hosting less popular JS scripts and other files without having to pay bandwidth costs. As a free open-source content distribution network, jsDelivr allows for the uploading of JS libraries, jQuery plugins, CSS frameworks, fonts, and various other files.

Of course, no responsible developer wants to host files essential to their theme on a shaky CDN that runs the risk of intermittent availability and potential downtime. jsDelivr is extremely reliable. It is sponsored by MaxCDN and CloudFlare, two of the biggest CDN providers around, uses Cedexis for load balancing, and has dozens of edge nodes with 42 points of presence across the globe.

By using two different CDN providers, jsDelivr can maintain reliability and performance even in the unlikely event that one of its partners goes down. If you’re interested in the full details of how jsDelivr works, take a look at this comprehensive explanation by Dmitriy Akulov, the creator of jsDelivr.

At the time of writing, jsDelivr makes over 1000 files available to developers and uploading new ones is fairly straightforward if you know how to use GitHub. To add a file of your choice, you simply clone the jsDelivr GitHub repository, add the files you’d like to see hosted and issue a pull request. Files are vetted for suitability by volunteers, so it may take a few hours to get approval, but once your pull request is merged, the files will be made available on the CDN.

jsDelivr is a great service for theme developers and anyone else who needs to use a CDN without paying through the nose for bandwidth.
If you’re a WordPress user, there’s also a plugin that makes it easy to integrate jsDelivr-hosted files with your site.

* * *

About Rachel Gillevet:

Rachel is the technical writer for WiredTree, a leader in fully managed dedicated and vps hosting. Follow Rachel and WiredTree on Twitter, @wiredtree, Like them on Facebook and check out more of their articles on their web hosting blog, wiredtree.com/blog.

This entry was posted in jQuery, Usability. Bookmark the permalink.