开发者

Any tools to identify undefined CSS/HTML classes?

开发者 https://www.devze.com 2022-12-31 08:39 出处:网络
Are there any tools out there that can look at my website HTML and t开发者_开发问答ell me that (for example) \"there is an HTML element at mysite.com/example.html using a class of SOMECLASS but SOMECL

Are there any tools out there that can look at my website HTML and t开发者_开发问答ell me that (for example) "there is an HTML element at mysite.com/example.html using a class of SOMECLASS but SOMECLASS is not defined in any included CSS files".

?


I've created a snippet that does exactly that: https://gist.github.com/kdzwinel/426a0f76f113643fa285

You can run it in the DevTools console and the sample output will look like this:

Any tools to identify undefined CSS/HTML classes?


You could try out a Firefox plugin like Dust-me-selectors


You could try inspecting with Firebug


There is a free Windows desktop tool that can scan a local web project folder and output undefined css classes, i.e. classes that are used in html but are not defined in any css. It also takes JavaScript into account to some degree.

https://sourceforge.net/projects/cssscanner/

Any tools to identify undefined CSS/HTML classes?

All other answers either didn't work for me or didnt understand the question (including the accepted answer). This one I just tested myself and it works surprisingly well, though it won't catch every edge case.

0

精彩评论

暂无评论...
验证码 换一张
取 消