优化-是否有任何方法可以查找和删除所有html页面共有的未使用的CSS和Javascript? [英] Optimization- Is there any way to find and remove unused CSS and Javascript common to all html pages?
问题描述
我的网站上有很多网页,我正在尝试清理样式表和脚本.我的网站中的任何html页面均未使用每种js/css的大约10%或更多.我需要删除常见的未使用和冗余的CSS和JS.我做了一些研究,发现此.但这不是免费的.
注意:
My website has many webpages and I am trying to clean up my stylesheets and scripts. About 10% or more of each js/css are not being used by any of the html pages in my website. What I need is to remove the common unused and redundant css and js. I did a bit of research and found this. But it is not free.
NOTE:
- 多个js页面正在调用某些js/css,但每个调用它们的html页面仍未使用每个js/css的一部分.
- 我的网站仅在Chrome中兼容.
推荐答案
是的,您应该使用Addy Osmani的 grunt-uncss插件清理未使用的CSS.我不确定是否可以使用工具来删除未使用的JS,因为它取决于应用程序逻辑,这将调用JS代码的哪一部分.
Yeah, you should use Addy Osmani's grunt-uncss plugin to clean up unused CSS. I am not so sure whether you can use a tool for removing unused JS, since it depends on application logic, which part of JS code will be called.
这篇关于优化-是否有任何方法可以查找和删除所有html页面共有的未使用的CSS和Javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!