scalableminds / amd-optimize

An AMD (RequireJS) optimizer that's stream-friendly. Made for gulp.
MIT License
162 stars 29 forks source link

Brute-force implementation of requirejs-text plugin #31

Closed kirill-konshin closed 9 years ago

kirill-konshin commented 9 years ago

I honestly don't think it is a best way to implement requirejs-text plugin, but it is something close enough. Should be OK for most cases.

As a proposal, you can build a queue of plugins where developers can intercept loading procedure for modules and do what they want with them. For example

amdOptimize('foo', {
    plugins: [text(), less(), typescript(), ...]
}

each plugin should provide the prefix to resolveModuleName() function, this prefix should trigger plugin execution later on in defaultLoader(). Default js loader should probably be one of available plugin (maybe last in the queue) so that defaultLoader() will remain abstract.

normanrz commented 9 years ago

Thanks for making this. I think it works for now. We should definitely implement something like you proposed. We should look into how we can incorporate the existing gulp plugins for that.

atesgoral commented 9 years ago

:heart: @kirill-konshin