yui/yui3 — pull request #165 by ryanvanoss (2012-06-15 17:47:24+00:00)
Title: skin.order.loader.enhancements

Loader enhancement that adds an `order` property to the `skin` property of config (http://yuilibrary.com/yui/docs/api/classes/config.html#property_skin). Preserves backwards compatibility, and adds the ability to have a fallback system when specifying skins and does not require
the user of the framework to have to remember which modules support which skins:

YUI({
skin: {
order: 'night,sam'
}
}).use('test', 'calendar', function (Y) {...});

This tells the framework to load the first available skin in the ordered list of
skins for each module in the `use` call. So for calendar it will load the
__night__ skin because calendar supports it and for test it will load the
__sam__ skin since it is the only skin that it supports.

Since the `defaultSkin` is always included as the last skin in the ordered list,
you can also write (because the default skin is __sam__):

YUI({
skin: {
order: 'night'
}
}).use('test', 'calendar', function (Y) {...});

For a more extreme example, look at slider-base, it is the only module that supports
9 skins so we could write the following and the framework will load the skins in
that order of preference. Later on, when calendar supports __round__ or
__round-dark__, there would be no changes needed to the code below.

YUI({
skin: {
order: 'round,round-dark,night,sam-dark'
}
}).use('test', 'calendar', 'slider-base', function (Y) {...});

The addition of the `skins.order` property is backwards compatible which means
that changing the `defaultSkin` and using `overrides` still works as expected.

Metadata for skins (see MOD_SKINS in Loader.js 46-75) generated by [comp_skins](https://github.com/ryanvanoss/comp_skins) and could be added to build files (a la requires metadata).

You can play with skin order and overrides here: http://23.21.81.23/yui3configurator/index.php, and run the existing unit tests, along with the additional tests from this pull request, here: http://23.21.81.23/yui/tests/loader/tests/index.html.

Configurator source code available here: https://github.com/ryanvanoss/yui3configurator