WP cdnjs plugin to include cdnjs libraries in WordPress
Recently the WP cdnjs plugin for WordPress has been launched that allows us to include cdnj libraries in a simple way and without having to edit the theme code manually . This article has a double objective, on the one hand to analyze the WP cdnjs plugin and on the other hand to talk about the cdnjs service that some of you will not know.
What is the cdnjs service?
The main advantages of Cdjns are:
- The files are distributed through a CDN infrastructure (provided by CloudFlare) which speeds up the loading of these resources.
- It contains many libraries and resources , not just the most famous. We all know the Google CDN and the Microsoft CDN , but both contain only the most famous libraries while cdnjs has a much wider collection.
- Resources hosted on cdnjs can be downloaded via HTTP, HTTPS or SPDY.
- It has an uptime of 99.9% (online time without service cuts).
As we see its advantages are not few, so the use of cdnjs is a reliable way to add libraries or static files to our web projects.
Analysis of the WP cdnjs plugin for WordPress
The functionality of WP cdnjs is basically to include libraries hosted in cdnjs in WordPress easily and without editing any files.
Once the plugin is installed, in the « Settings» tab a new option « WP cdnjs settings» appears , from which we can search the libraries we want to include in our WordPress blog.
When it comes to including files, the plugin offers a number of very interesting options:
- Direct search for libraries hosted on cdnjs.
- An interface that allows drag and drop to sort the different libraries.
- Allows you to select between the minified version or the standard version.
- It allows to specify where we want each library to be included, in the footer or in the header.
- It allows to enable / disable the libraries included with a simple click.
- The libraries are included with relative protocol URL, so the browser will decide whether to use the HTTP or HTTPS version. For example, the standard URL would be
http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.jsor the https version
https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js, but the plugin uses the relative protocol URL in this way
In short, it is a plugin with a very friendly and easy-to-use interface and especially useful for developers. Personally I prefer to use the Google CDN but if the library is not available I use cdnjs.