I know, I know jQuery is code smell but project I'm currently working at the moment we're doing things based on jQuery plugins. I was wondering what the best to way to use component with jQuery plugins. For example:
Say I have a plugin defined
;(function( $, window, document, undefined ) {
// Plugin here
})( jQuery, window, document );
I would like to have it so I can do this, say I'm using component-emitter.
;(function( $, window, document, undefined ) {
var Emitter = require('emitter');
// Plugin here
})( jQuery, window, document );
I would like to be able to use the jQuery plugin it the normal fashion of $(selector).plugin(options). We're also concatenating our js with grunt so I'm currently adding the build file to that concat. At the moment the error I'm getting is the plugin is undefined, so maybe component is doing something with the build file.
2)
I also had a question about the dependencies and the file sizes, how does component prevent file sizes from getting out of control?
Say I have:
ComponentA
depends on emitter, ....
ComponentB
depends on emitter, ....
ComponentC
depends on emitter, ....
ComponentD
depends on emitter, ....
If I'm using these components on the same page will the emitter code be written 4 times?