cafespain
Member
Posted 16 years ago #
Hi all
As Google have announced that they intend to host Javascript libraries for each of the major libraries I thought I would throw together a quick plugin that will automatically switch your WordPress site from using locally hosted javascript libraries to using those hosted by Google.
Activating the plugin will switch your site to use the Google libraries, de-activating will switch it back to the default.
It will only switch scripts loaded with wp_enqueue_script.
The plugin is available here:
http://blog.clearskys.net/2008/05/28/google-ajax-libraries-api-plugin/
To enable the plugin for your entire site simply put it in the MU-plugins directory instead of the standard plugins directory.
Have you noticed any improvements in loading times by doing this?
Thanks,
Andrew
cafespain
Member
Posted 16 years ago #
For me (as a non standard user), it seems quicker.
It certainly seems quicker (though I have no metrics as yet) if I go to multiple blogs on my own server.
Rather than loading:
http://blog1.mysite.com/.../jquery.js
and then
http://blog2.mysite.com/.../jquery.js
The caching seems to come into play as it's loading jquery from a single source now. Though I suppose if you held all your static files on a single separate domain then you would get a similar effect.
I suppose the main benefit of the caching will be achieved if / when more sites start using the Google hosted libraries.