yahoo/express-yui — pull request #56 by caridy (2014-03-26 23:36:07+00:00)
Title: [experimental] adding applyConfig and yepnope patch to support conditions

WIP

This PR adds support for conditions outside of the scope of the current conditions implemented by YUI:

It allows you to apply a condition at any given time, and this condition will dictate how things are going to be loaded.

First, we need to apply a patch (ideally this will be implemented in YUI directly):

```
app.yui.patch(require('express-yui/lib/patches/yepnope'));
```

After that, we could start calling `app.yui.applyConfig()` on the server and/or client, it doesn't matter much:

```
app.yui.applyCondition('intl-messageformat', {
test: function (Y) {
return !!Y.config.global.Intl
},
nope: ['intl-polyfill'],
yep: []
});
```

This will guarantee, that the module denoted by `intl-polyfill` will be attached before `intl-messageformat` if a global `Intl` member does not exists.