托管定制(较小)jQuery UI 与从 CDN 进行全尺寸(大)下载的链接?
我应该链接到完整的 jQuery UI -还是- 提供精简的自定义副本?
来自 Google 等 CDN 的完整 jQuery-UI 与提供定制的最小版本之间存在非常显着的大小差异。此外,还可以将 jQuery、jQuery UI、插件和本地代码组合到一个缩小的 JavaScript 下载中。
另一方面,用户缓存自定义副本的可能性为零,除非他们之前访问过该网站。
是否有任何 jQuery CDN“渗透”统计数据或研究可以帮助您深入了解哪个可能更好?
Should I link to the full jQuery UI -or- provide a slimmed-down customized copy?
There is a very significant size difference between the full jQuery-UI from a CDN like Google vs. providing a customized minimal version. Additionally, one can combine jQuery, jQuery UI, plug-ins, and local code into one single minified JavaScript download.
On the other hand, the chances of a user having a customized copy cached are nil unless they've visited the site previously.
Are there any jQuery CDN "penetration" stats or studies that lend insight into which might be better?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通常会查看 jQuery UI 中要使用的组件,只有当我使用其中 50% 或更多的组件时,我才会使用 CDN 中的完整 UI。
以下是来自 的一些很好的推理和(有点过时)统计数据http://zoompf.com/blog/2010/01/should-you-use-javascript-library-cdns
问题显然是并非所有网站都这样做,并且并非所有网站都使用相同的CDN 不断降低点击率。最重要的是,还有版本控制,如果您需要旧版本,那么这会不断降低可能性。
我不会将它用于 jQuery 本身,因为命中的概率似乎更高,而且它带来的其他好处也消除了 DNS 查找的开销。
I usually take a look at the components I would be using from jQuery UI and only if I am using 50% or more of the components in it I would use the full UI from the CDN.
Here is some great reasoning and (a bit outdated) stats from http://zoompf.com/blog/2010/01/should-you-use-javascript-library-cdns
The issue obviously is that not all sites do it, and not all use the same CDN which keeps lowering the probability for a hit. On top of that then there's versioning, if you need an older version then that'll keep lowering the probability.
I dfntly use it for jQuery itself since the probability for a hit seems higher and also the other benefits that come with it defeat the overhead of DNS lookups.