检查未使用的 CSS 选择器的工具?

2022-01-10 00:00:00 css-selectors javascript css stylesheet

我知道有一个名为 Dust-Me Selectors for Firefox 的扩展,而且它不查看 JavaScript 生成的动态 HTML.

I know there is an extension called Dust-Me Selectors for Firefox and also that it doesn't look at dynamic HTML generated by JavaScript.

我正在寻找可以从样式表中识别所有未使用的选择器的工具,这些选择器附加到多个页面,并且所有 JavaScript 都在运行并检查选择器?我现在知道的唯一选择是手动检查文件并找到未使用的选择器:(

I'm looking for tool(s) that can identify all unused selectors from a stylesheet, attached to several pages, with all the JavaScript running and checking selectors? The only option I know right now for this is manually checking files and finding unused selectors :(

在 IDE 中 - 我相信 NetBeans 在编写 Java 代码时会在未使用库时提供警告消息.如果没有 IDE(NetBeans、Eclipse、Dreamweaver 等)插件来搜索选择器,我的选择是什么?

In IDE's - I believe NetBeans provides a warning message when writing Java code, if a library is not under use. Without an IDE (NetBeans, Eclipse, Dreamweaver, etc) plugin to search for the selectors what are my options?

另外,是否有工具可以检查同一文件中未使用的选择器.我的意思是如果所有的 JS、HTML 和 CSS 代码都在同一个文件中.

Also, is there a tool to check for unused selectors in the same file. I mean if all the JS, HTML and CSS code is in the same file.

推荐答案

我认为 http://unused-css.com 会做你想做的事.

I think that http://unused-css.com will do exactly what you want.

https://github.com/geuis/helium-css可以帮忙

以及:http://razorfast.com/2010/11/21/announcing-cssess-the-bookmarklet-that-finds-unused-css-selectors/

相关文章