开发者

Distributing a jQuery plugin - what files are necessary?

开发者 https://www.devze.com 2023-02-11 02:28 出处:网络
I am using the popular jquery.validation plugin. I downloaded the zip file and see that it contains a number of files.

I am using the popular jquery.validation plugin. I downloaded the zip file and see that it contains a number of files.

/demo/
/lib/
/localization/
additional-methods.js
changelog.txt
jquery.validate.js
jquery.validate.min.js
jquery.validate.pack.js
todo

I would like 开发者_运维百科to keep things light. Deleting demo folder, changelog.txt, jquery.validate.js and todo seem obvious. I will include the reference to min.js in my html file. What about pack.js? What is that? Do I really need the localization and lib folders? The lib folder contains jquery which seems like a waste because I already load jquery from google's CDN.

Can anyone point me to a standard way for distributing jquery plugins in a light manner?


I think all you need, in that particular example, is jquery.validate.min.js (which will be the minified version of jquery.validate.js). The localization files provide localisations (translations) of messages. I'd guess that jquery.validate.pack.js is a packed version of the library. If you're already loading jQuery via the CDN, you certainly don't need those files from lib. You only need jquery.form.js and/or jquery.metadata.js if you're using those features; from the plug-in's page.

Dependencies:

Required
* jQuery 1.3.2 or 1.4.2, compatible with both

Optional
* metadata plugin to read validation rules from markup
* form plugin for AJAX submit

If you're creating your own plug-in, it may well be a single file — the file that defines your plug-in methods. Or if it's doing UI stuff, you might have a file and a CSS file (or multiple CSS files, or possibly even images for spriting, etc.). If you present messagse to the user, you may well want to do localization and have locale files.

0

精彩评论

暂无评论...
验证码 换一张
取 消