cujojs / curl

curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.
https://github.com/cujojs/curl/wiki
Other
1.89k stars 216 forks source link

Extension-based loading strategy #234

Open briancavalier opened 10 years ago

briancavalier commented 10 years ago

It'd be great to support loading different types of resources based on file extension, or module id pattern matching. Also, AMD plugin syntax, or the like, will not be supported as a first-class syntax in ES6 module loaders, so that's an indication that an AMD-like plugin approach probably is not the future. Using Extensions and/or pattern-matching is also closer to how Node's require extensions work.

briancavalier commented 10 years ago

After discussion w/@unscriptable, I added a simple experiment in the extension-based-loading branch. It's a plugin that delegates to other plugins by transforming resource ids based on their extension. It works great, but requires that you either explicitly use it as a plugin, e.g. 'ext!', or specify it as a moduleLoader. Neither is really ideal (hence it's still an experiment :) ), but at least it shows that resource id transformation is a valid approach.

It'd be nice if this were mostly invisible, but we still need to work that out.

gehan commented 10 years ago

Any progress with this at all? :D

unscriptable commented 10 years ago

Sorry, @gehan. Not much time lately. :(

gehan commented 10 years ago

No probs! Was mainly of interest for relative paths in specs which seems to be possible in the newest develpments!