Mike Boers
Mike Boers

Reputation: 6735

Why have the "jquery." prefix on plugin filenames?

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?

Upvotes: 15

Views: 3640

Answers (1)

Nick Craver
Nick Craver

Reputation: 630469

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.

Upvotes: 20

Related Questions