您网站上的自定义jQuery脚本中有几行代码?多少钱太多了? [英] How many lines of code is in your custom jQuery script on your site? And how much is too much?

查看:148
本文介绍了您网站上的自定义jQuery脚本中有几行代码?多少钱太多了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我们的网站,我使用了大量的jQuery-目前,我正在基础库顶部查看340行jQuery代码.多少是太多了?我将添加更多内容,何时开始尝试压缩代码并最终转换为OOP?

For our site, Im using a lot of jQuery - right now Im looking at 340 lines of jQuery code on top of the base library. How much is too much? I will be adding more, when do I start trying to condense the code and eventually move to OOP?

推荐答案

最理想的情况是,您应该将脚本大小保持为最小,但是对于当今的"Web 2.0"网站,您很可能会积累很多JavaScript代码

Optimally, you should keep you script size as minimum as possible, but with today's 'Web 2.0' websites, you will most probably accumulate quite a lot of JavaScript code.

重要的是,在部署网站之前,请确保最小化 gzip 您的脚本文件,以尽可能减少脚本文件的大小尽可能.

The important thing is that before you deploy your website, make sure to minify and gzip your script files as to reduce the size of your script files as much as possible.

如果您真的对优化和改善网站性能感兴趣,我强烈建议您看看Steve Souders的高性能网站:前端工程师的基本知识

If you are really interested in optimizing and improving your website performance, I highly recommend taking a look at Steve Souders' High Performance Web Sites: Essential Knowledge for Front-End Engineers

这篇关于您网站上的自定义jQuery脚本中有几行代码?多少钱太多了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆