Minifiers and jQuery plugin conflicts

Am I right in saying if you wrote a jQuery plugin thus:

;(function($) {

    $.fn.aPluginWithAUniqueEnoughName = function(options) {  
        return this.each(function() {
            $.fn.somePublicFunction = function() { };
        });
    };

})(jQuery);

For there to be a conflict someone would have to write another plugin called aPluginWithAUniqueEnoughName — and that anyone else is free to use the public function somePublicFunction() so long as it’s under a different plugin name. Is that correct?

The reason I ask is I’ve got a site that broke after I updated a plugin and it’s been a nightmare to debug. It’s several quite well respected plugins minified separately and combined into a file.

If you run jQuery plugins through minifiers separately and then combine the files yourself can this create a conflict? The reason I ask is if I separate out all the plugins into their own files and link them to a single file using CodeKit (which I am assuming goes through all the files and minifies them as a whole) it works.

I don’t know, maybe the app I used to minify separately (Smaller for Mac) uses an inferior minifier to CodeKit. Or maybe when you create your minified file the minifier needs to be aware of everything going into it.

I guess I don’t have a problem per se as I can just use CodeKit; it just bugs me when there are anomolies like this I can’t understand.

Any thoughts or help? Thanks.

A somewhat older article, but AFAIK is still applicable today.
Namespacing

Thanks, I’ve actually realised the problem was with a major bug in one of the plugins and not the minifier! Both Smaller and CodeKit seem to be doing their job properly!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.