Forget about Google’s hosted libraries and say hello to CDNJS. I can’t believe I’ve only now found out about this!
Elevator pitch:
- Has servers in Australia wheres Google doesn’t, so latency is an order of magnitude faster
- Has tonnes of javascript, css and other frontend libraries – much larger selection than google
- List of libraries is community managed via github
Those are pretty much the key points. Read more here, and it’s located at cdnjs.com.
My own testing confirms the massive latency benefit over Google – just check out this download of jQuery, 0.9 seconds for Google versus 0.06 seconds from CDNJS. That’s a crazy big difference!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
[max@soshi ~]$ wget http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js --2014-11-06 10:52:08-- http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js Resolving ajax.googleapis.com (ajax.googleapis.com)... 74.125.31.95, 2404:6800:4008:c00::5f Connecting to ajax.googleapis.com (ajax.googleapis.com)|74.125.31.95|:80... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [text/javascript] Saving to: ‘jquery.min.js’ [ <=> ] 92,629 102KB/s in 0.9s 2014-11-06 10:52:13 (102 KB/s) - ‘jquery.min.js’ saved [92629] [max@soshi ~]$ wget http://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js --2014-11-06 10:52:25-- http://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js Resolving cdnjs.cloudflare.com (cdnjs.cloudflare.com)... 198.41.214.183, 198.41.215.182, 198.41.214.187, ... Connecting to cdnjs.cloudflare.com (cdnjs.cloudflare.com)|198.41.214.183|:80... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [application/javascript] Saving to: ‘jquery.min.js.1’ [ <=> ] 92,629 --.-K/s in 0.06s 2014-11-06 10:52:30 (1.39 MB/s) - ‘jquery.min.js.1’ saved [92629] |
If you’re supplying Australian customers, you would be mad not to use it.