javascript jquery.js 和 jquery.lite.js 有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12264504/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is difference between jquery.js and jquery.lite.js?
提问by Ketan
When I download the jQuery zip file LINK. It gives me 4 different files:
当我下载 jQuery zip 文件LINK 时。它给了我 4 个不同的文件:
- jquery.js
- jquery.lite.js
- jquery.min.js
- jquery.pack.js
- jQuery.js
- jquery.lite.js
- jquery.min.js
- jquery.pack.js
pack.js
is the most compressed one of that js file and min
is minified.
So I have two questions...
pack.js
是该 js 文件中压缩率最高的文件之一,并且min
被缩小了。所以我有两个问题...
- What is difference between
jquery.js
andjquery.lite.js
. There looks to be no difference when I view code. - What is better to use
min.js
orpack.js
on a live website?
- 有什么区别
jquery.js
和jquery.lite.js
。当我查看代码时看起来没有区别。 - 使用
min.js
或pack.js
在实时网站上使用哪个更好?
回答by Alexander Wigmore
Answer to the question:
回答问题:
jquery.js- Full expanded including comments.
jquery.js- 完全扩展,包括评论。
jquery.lite.js- Not really relevant anymore - new releases don't give this - it mainly used to lack comments and less used features.
jquery.lite.js- 不再真正相关 - 新版本没有提供 - 它主要用于缺少评论和较少使用的功能。
jquery.min.js- The main one to use nowadays - all whitespace and comments removed.
jquery.min.js- 现在主要使用的 - 删除了所有空格和注释。
jquery.pack.js- Smaller in size - but requires 'unpacking' time, sort of like a rar/zip would.
jquery.pack.js- 尺寸更小 - 但需要“解压”时间,有点像 rar/zip 文件。
But honestly, as others have mentioned use the latest releaseof jQuery if possible.
但老实说,正如其他人所提到的,如果可能,请使用最新版本的 jQuery。
-
——
Updated information for 2018:
2018 年更新信息:
Compressed production- Removal and minification of code, no spaces/line breaks, hard for humans to read but smaller in size so it loads faster.
压缩生产- 删除和缩小代码,没有空格/换行符,人类难以阅读但尺寸更小,因此加载速度更快。
Uncompressed production- Larger file size, easier for developers to work on but shouldn't be used in production due to unnecessary file size.
未压缩的生产- 更大的文件大小,开发人员更容易处理,但由于不必要的文件大小,不应在生产中使用。
Map file- Helps developers/web browsers find references to the original location of JS code before it was compressed.
映射文件- 帮助开发人员/网络浏览器在压缩之前找到对 JS 代码原始位置的引用。
Slim builds- This version of jQuery doesn't include a few larger libraries, such as the AJAX and effects modules.
Slim builds- 此版本的 jQuery 不包含一些较大的库,例如 AJAX 和效果模块。
回答by Andrea Turri
If you're looking for a CDN, use Microsoft or Google cdn:
如果您正在寻找 CDN,请使用 Microsoft 或 Google CDN:
https://developers.google.com/speed/libraries/devguide#jquery
https://developers.google.com/speed/libraries/devguide#jquery
or
或者
http://www.asp.net/ajaxlibrary/cdn.ashx#jQuery_Releases_on_the_CDN_0
http://www.asp.net/ajaxlibrary/cdn.ashx#jQuery_Releases_on_the_CDN_0
Use the latest version, the .lite.js
is not an official jQuery version, same for the .pack.js
.
使用最新版本,这.lite.js
不是官方的 jQuery 版本,对于.pack.js
.
On the jQuery website you can only find Production (Minified) or Development (not Minified) versions.
在 jQuery 网站上,您只能找到生产(缩小)或开发(非缩小)版本。
Here: http://docs.jquery.com/Downloading_jQueryyou'll find all the official information about versions of jQuery.
在这里:http: //docs.jquery.com/Downloading_jQuery您将找到有关 jQuery 版本的所有官方信息。