Using the YUI Loader and Yahoo’s CDN Rollup

Using the YUI Loader and the script below will allow you to implement the YUI framework within your application with out downloading and installing the YUI framework to your server.



Verify Installation:

I have included a console function that will send a warning to your FireBug application telling you that everything has loaded correctly. If you run this code and see the warning message in your FireBug console, then your code is installed correctly.

Adding your own code:

Replace the following line with your code and your ready to run.

console.warn('YUI Loaded');

Adding resources from YUI:

In order to use specific parts of the YUI framework you will need to request the files from the YUI CDN. To do this simply add the required YUI library to the require array as shown below.

"require: ["get","dom","event","datatable","animation"],

Things to remember

The YUI Loader may cause problems when working with older browsers such as IE6. Be sure to wrap you loader using the onDOMReady method like so.

Yevent.onDOMReady(init);

This will ensure that the browser has finished loading the DOM before firing off your scripts.

UPDATED (2009-07-22): “missing > in code and removed Yevent shortcuts”

  • Technorati Favorites
  • DZone
  • Facebook
  • Slashdot
  • Yahoo Buzz
  • Twitter
  • Yahoo Bookmarks
  • Reddit
  • Digg
  • MySpace
  • StumbleUpon
  • LinkedIn
  • Delicious
  • Blogger Post
  • Bebo
  • Google Reader
  • Share/Bookmark

One response to “Using the YUI Loader and Yahoo’s CDN Rollup”

  1. [...] right people.”  Head over to Lunch.com to grab a place on the waiting list for the beta.Jeffrey Cobb: “Using the YUI Loader and Yahoo’s CDN Rollup”: Jeff writes on his YUICoder blog about how to use Adam Moore’s YUI Loader to bring YUI into [...]

Bookmarks

Ads