查找未使用的 css
我正在为我们内部网络上的一些页面进行一些开发。我想知道是否有开源工具或 FF 插件可以识别项目中未使用的 css。
我已经考虑过使用这个,但是当我尝试安装附加安装程序时显示“与 Firefox 3.6 不兼容”
https://addons.mozilla.org/en-US/firefox/addon/dust-me-selectors/
请注意,这是针对内部网的 -不是www 可见网站 - 所以我无法使用提供此类服务的在线网站。
I'm doing some development for some pages on our internal network. I want to know if there's an open source tool or FF plugin which can identify unused css within a project.
I've looked at using this, but when I try to install the Add-on Installer says "Not compatible with Firefox 3.6"
https://addons.mozilla.org/en-US/firefox/addon/dust-me-selectors/
Please note, this is for an intranet - not a www visible website - so I can't use the online sites which offer such services.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
Google Chrome(因此可能还有 Safari)安装了开发人员工具,其中包含审核。当您审核页面时,未使用的 CSS 规则是它检查的一件事。
这是此页面上的样子。
Google Chrome (and therefore probably Safari as well) have the developer tools installed, which come with Audits. When you audit the page, the unused CSS rules is one thing it checks.
Here's what it looks like on this page.
我已经寻找了一段时间,我发现的最好的东西是:
http://unused-css.com/
他们扫描您的网站并通过电子邮件将结果 css 发送给您。
我知道您正在本地网站上工作,但是如果您找不到其他选择,您可以将您的网站上传到某个地方并使用它
或者
您可以安装以前版本的 Firefox与dust-me选择器兼容,并与您当前安装的firefox一起运行。
I've been looking for a while, and the best thing I found was this:
http://unused-css.com/
They scan your site and email you the result css.
I am aware you are working on a localsite, however if you find no alternative, you can upload your site somewhere and use this
Alternatively
You could install a previous version of firefox that is compatible with dust-me selectors and run it along side your current installation of firefox.
我在 FF 中安装了 CSS 使用。但几乎没用过一次。它搜索当前页面上未使用的 CSS,而不是整个项目。
I have CSS Usage installed in FF. But barely used it once. It searches for un-used CSS on the current page, not the whole project though.
dust-me-selectors Firefox 插件现在与 Firefox 16 兼容...
dust-me-selectors Firefox addon is now compatible with Firefox 16...
是否可以将所有 HTML 页面合并到一个页面中,例如使用:
那么您可以在这个单一的“超级”页面上运行 Firefox/CSS 使用吗?
Is it possible to combine all of your HTML pages together into one single page, for example using:
Then you could run Firefox/CSS Usage on this single, 'super' page?
sourceforge 有一个名为 CSS Scanner 的新程序,它扫描 html、aspx、php、javascript 和 jquery 代码中已使用和未使用的 css 类和样式表。
这是 .net 代码,因此您需要 Windows:
http://sourceforge.net/projects/cssscanner/
There is a new program at sourceforge called CSS Scanner, it scans for used and unused css classes and stylesheets in html, aspx, php, javascript and jquery code.
It's .net code so you'll need Windows:
http://sourceforge.net/projects/cssscanner/
Chrome 插件可以生成在页面中有效使用的 css 规则的样式表,可以尝试快速获得结果。这是链接
https://chrome.google.com/webstore /detail/css-remove-and-combine/cdfmaaeapjmacolkojefhfollmphonoh
它还提供了有关未使用的规则的摘要。
这个涉及到 grunt 和相关插件来查找未使用的代码
http://addyosmani.com/blog/removing-unused-css/< /p>
Chrome addon, which generate stylesheet of css rules effectively used in a page, can be tried for the quick results..here is the link
https://chrome.google.com/webstore/detail/css-remove-and-combine/cdfmaaeapjmacolkojefhfollmphonoh
It also gives summary about the rules, which are not been used.
And this one involves grunt and related plugins to find unused code
http://addyosmani.com/blog/removing-unused-css/
如果您熟悉 Node js,还可以使用“查找未使用的 css”: https://www.npmjs.com/package/find-unused-css
If you are familiar with node js you can also use "find unused css": https://www.npmjs.com/package/find-unused-css