views:

30

answers:

1

I'm curious as to the reasoning behind the standard procedure of prefixing jQuery plugin filenames with "jquery.". Several tutorials state something like:

The use of the "jquery." prefix eliminates any possible name collisions with files intended for use with other libraries.

I believe I have even seen a couple of plugins that actually require themselves not be renamed.

Are there any more specific reasons for this prefix, or is it simple the convention?

+4  A: 

It's just a convention, for example:

jquery.lightbox.js
prototype.lightbox.js

If you just had this and were using both, well, you see where confusion sets in:

lightbox.js

Also, you might be using just vanilla JavaScript function files, and not want those to have a prefix, e.g. editor.js, denoting it has no reliance on jQuery at all...it's all around organization and maintainability.

Nick Craver
One could also throw everything in a `jquery` directory to get the same effect, but I suppose that would then require breaking up a possible package that has `example.js`, `jquery.example.js`, `prototype.example.js`, and `example.css` together.
Mike Boers
@Mike - That's certainly a valid approach as well...there are probably a dozen valid approached here, the `jquery.` is just the most common...whichever method works for you, use it :)
Nick Craver