CDN.js is small (30kb), but opens doors to hundreds of popular fully-hosted scripts. You can view it online or just download it and get going.
These are the libraries that can be included by name:
CDN.js is great at loading many script tags at once, from a professional CDN. To load scripts, simply name them and specify a version that you want. You can use * instead of a version number to get the current stable version.
load underscore and zepto to use on the page
CDN.js is great at loading commonjs modules. the require() method can be used sync or async, depending on if you pass it a callback. With a callback, you'll get the module's exports as the first argument to your callback, which is invoked when the module finishes loading, much like AMD/requirejs. Without a callback, your app will grind to a halt until the module has loaded and the result will be assigned to the require() function's return, just like in node.js.
load underscore async (AMD style) and use it to total an Array of numbers:
load underscore sync (node.js style) and use it to total an Array of numbers:
Like require() with a callback, inject() works on non-commonJS module scripts. the callback is invoked without any arguments, but after the external script is done loading and ready to be used.
inject a script on-demand after page loads, executing a callback when the script loads:
Like require() without a callback, injectSync() handles non-commonJS module scripts. The application pauses until the script loads at which point control is returned to subsequent expressions.
inject a script on-demand after page loads, but wait until it's parsed before returning flow to the program:
CDN.compile() fetches the source code of all CDN-loaded scripts, and concats them together into a single String. Making it easy to bundle all your depends, you can save this string to a js file, and use it instead of CDN.js on distributed or offline-capable projects.
CDN.search() accepts a single String or RegExp argument and returns an Array of strings of all script package short-names that match.
CDN.injectScriptTag() accepts a single String, the URL of a script file to add to the document, and returns the newly-created DOM SCRIPT Element to allow binding onload handlers, tag.remove()ing the script (cancelling) after a time-out period, etc. Outside of CDN-managed scripts, a simple dependency relationship can be accomplished by using a script's onload() event to dispatch the needy script: