用于查找未使用的 CSS 样式的 Firefox 插件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7147441/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 01:22:18  来源:igfitidea点击:

Firefox addon to find Unused CSS styles

cssfirefoxfirefox-addoncss-selectorsbrowser-addons

提问by testndtv

Possible Duplicate:
Tool to identify unused css definitions

可能的重复:
识别未使用的 css 定义的工具

Lets say I have a page displayed in my browser and I have a .CSS file used on this page with rules like

假设我在浏览器中显示了一个页面,并且我在此页面上使用了一个 .CSS 文件,其规则如下

    .class1{
    /* some style definitions */
    }
    .class2{
    /* some style definitions */
    }
    .class3{
    /* some style definitions */
    }
....
...
.class1001{
    /* some style definitions */
    }

Now my question is is there any addon which would tell me like out of these rules, which are "NOT USED" on the page..

现在我的问题是是否有任何插件可以告诉我这些规则之外的内容,这些规则在页面上“未使用”。

I saw some related questions which provide links to addon that tell CSS selectors which are used on a page..But I have like 1000+ rules and hence want to directly know RULES which are NOT used..

我看到了一些相关的问题,这些问题提供了插件的链接,这些插件告诉页面上使用的 CSS 选择器..但我有 1000 多个规则,因此想直接知道没有使用的规则..

JUST TO ADD, the addons mentioned have 1 issue; Like if there are hacks for IE (e.g. *html), it marks them as UNUSED, even though it is actually used in IE. Is there any workaround for this ?

只是为了添加,提到的插件有 1 个问题;就像 IE 有 hacks(例如 *html)一样,它会将它们标记为 UNUSED,即使它实际上是在 IE 中使用的。有什么解决方法吗?

Please help me. Thank you.

请帮我。谢谢你。

回答by Kyle

If you use Firefox, you can use the Dust Me Selectorsplugin that does exactly what you asked for. It finds unused Selectors for you :) Give it a try!

如果您使用 Firefox,您可以使用Dust Me Selectors插件来满足您的要求。它会为您找到未使用的选择器 :) 试试看!

Also there is the CSS Usage plugin, that looks over your CSS file and tells you which ones are not being used. :)

还有CSS Usage 插件,它会查看你的 CSS 文件并告诉你哪些没有被使用。:)

回答by Litek