michaelficarra / commonjs-everywhere

:rainbow: minimal CommonJS browser bundler with aliasing, extensibility, and source maps
BSD 3-Clause "New" or "Revised" License
158 stars 21 forks source link

.use #77

Closed vendethiel closed 11 years ago

vendethiel commented 11 years ago

Add something like "cjsify.use(coffeePlugin)"? Would allow for more code reuse and maybe specify them from the CLI ?

michaelficarra commented 11 years ago

Can you give more detail about the desired behaviour?

vendethiel commented 11 years ago

Hook into cjs. Maybe add a small API for these plugins, like "addExtension", or hooks, stuff like that

vendethiel commented 11 years ago

Would also allow for stuff like :

cjsify src/entryfile.js --use cjsify-livescript,cjsify-stylus

And the CLI tool would require() and .use them, allowing to do everything from CLI. I'm not sure we can just return JS strings from handlers atm? Might be a first step

michaelficarra commented 11 years ago

You can return strings of JS from handlers, though it's not preferred. You might want to check out the --handler option. You provide an extension to which it applies and the name of a module that can be required. Just export a function just like the one you'd give in the handlers option. I think this is what you want.

vendethiel commented 11 years ago

If you can specify more than one, then yes, definitely!

michaelficarra commented 11 years ago

Yep, just use it more than once. Closing.

michaelficarra commented 11 years ago

Linking to #64.

vendethiel commented 11 years ago

Yeah, thanks, I can't close from GH mobile