Rogério Lino

Web development and tips

Quickpost: Javascript Resource Loader

yepnope is an asynchronous conditional resource loader that’s super-fast, and allows you to load only the scripts that your users need.

Good Things

  • yepnope.js is only 1.6kb - smaller than most and certainly a good size for its functionality set.

  • yepnope.js is called a “resource loader” because it can work with both JavaScript and CSS.

  • yepnope.js has a full test suite in QUnit that you can run in your set of supported browsers to make sure it works. (We run it via TestSwarm in every browser we can get our hands on)

  • yepnope.js fully decouples preloading from execution. This means that you have ultimate control of when your resource is executed and you can change that order on the fly.

  • The yepnope.js api is friendly and encourages logical grouping of resources.

  • yepnope.js is modular. It has a whole system for adding your own functionality and a couple examples of how you might do that. (Prefixes and filters).

  • The yepnope.js api encourages you to only load the resources that you need. This means that even when it’s slower than another script loader, it still can come out on top, because you could avoid an entire resource.

  • yepnope.js is integrated into Modernizr.

  • yepnope.js always executes things in the order they are listed. This is a pro for some, and a con for others. We think it’s a friendly default.

  • yepnope.js has the capability to do resource fallbacks and still download dependent scripts in parallel with the first.