3 ms·
I never even really thought of this until you mentioned it. There's probably a ton of unused elements in my css. Just found a firefox tool that helps with this
by mikegioia 17y ago
I never even really thought of this until you mentioned it. There's probably a ton of unused elements in my css.
Just found a firefox tool that helps with this: http://www.sitepoint.com/dustmeselectors/ http://www.sitepoint.com/dustmeselectors/
- dan_sim 17y agoThe problem is that a CSS selector in a rails project may be hidden to you but not to someone else. Thus, it would consider that some selectors are not used when they are by other users.
- mikegioia 17y agoAhh I gotcha, I'm unfamiliar with rails dev. Thanks.
- robin_reala 17y agoWell, that’s standard web app dev really. You have different users, and they have different pages available to them.
- billybob 17y agoDustMeSelectors is a nice tool for some applications. Here's how you use it. Option 1: Give it a site map. It will scan everything and give you a list of unused selectors. Option 2: Load up one of your pages and tell it to scan. It will give you a list of unused selectors on that page. Go to another page and scan. It will narrow down the previously-gathered list (if a selector was unused on the first page but is used on the second page, it is removed from the list). Repeat until you've covered everything you need to. When you're done, you can export the unused selector list to a CSV file. Each column is a style sheet, and each row is a selector. It's a lot faster than doing it by hand, but it does assume that you can see everything that anyone can see. At the very least, you can take that list and search your files for <div class="crazyselector"> and see if it is truly never used. If it's the only occurance, maybe you can refactor that HTML to use a more common selector.