Jakobo/inject — Issue #23: Alternate manifest using regexes to drive it
Author: Jakobo
Created: 2011-11-16 19:07:09+00:00
State: open

Through conversation with @peterfrueh, jquery's UI modules are difficult to load. In theory, we should be able to maintain the standard syntax:

```
$ = require("jQuery");
require("jquery.ui.core");
require("jquery.ui.mouse");
require("jquery.ui.widget");
require("jquery.ui.draggable");
// ... continue using $ normally
```

The limitations we are facing are best summed up as:

1. the jQuery UI objects look for `jQuery` in the global context. Because of require sandboxing, this isn't available by default. We could solve this by using the pointcuts syntax, but that yields issue 2 below
2. The current syntax doesn't allow for an easy way to package this up. You'd end up with a huge manifest, when really all you need is smarter regex rules

The result of this is a proposal for a new syntax that would deprecate require.manifest in favor of simpler additive rules

```
require.addRule(regex|string, [weight], {
path: function() {} | string
pointcuts: {
before: function() {},
after: function() {}
}
});
```