TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Know of a good tool that finds unused stylesheet selectors and rules?

7 pointsby apphackeralmost 15 years ago
It seems to be a common problem that as stylesheets mature and the project grows that eventually you may end up in a situation where you are not sure if various styles are still being applied anywhere. Does anyone know of a good way to figure this out with some kind of software tool?

3 comments

jacquesmalmost 15 years ago
You can't really be sure without running all of your javascript code and checking all of your pages, after all some hidden bit of javascript might change a style based on some event to match one in the css, it might even do it by combining various terms to form the selector, and it might manipulate the ids and classes of elements already on the page.<p>That's a tricky problem. I'm not aware of a tool, but if you find one I'll be happy to test it, I have a few of those questionable items in my style sheets that are still there 'just in case'.
评论 #1405498 未加载
rarestblogalmost 15 years ago
Google Chrome. Ctrl+Shift+J, Audits tab, Run...
评论 #1405681 未加载
tamersalamaalmost 15 years ago
There's a firefox plugin. <a href="https://addons.mozilla.org/en-US/firefox/addon/5392/" rel="nofollow">https://addons.mozilla.org/en-US/firefox/addon/5392/</a> It has been a while since I last used it but it generally gave good indications.