Removing (not searching!) Unused Dust-Me CSS selectors

Dust-Me (http://www.sitepoint.com/dustmeselectors/) did an excellent job of identifying unused CSS selectors, but now I need to remove them. Dust-Me generates .CSV listing these selectors, but the tricky part is actually removing them. I have 1200 unused selectors, and from those that are removed manually, I will drive. Is there a way to automate the removal process? Or is there another application that can remove unused CSS / restore CSS?

+4
source share
3 answers

Test Using CSS Firefox Extension (requires FireBug).
It does the same job as Dust-Me, and provides clean files.
Unfortunately, these tools are not very accurate ... Save a backup!

0
source

Try ReduceCSS , I think this is a tool that does this. Detects unused CSS selectors and preserves clean files.

0
source

+1 for using CSS Using the Firefox / Firebug extension. https://addons.mozilla.org/firefox/addon/css-usage/

as for the comment above jperelli: You can use a tool that can search / replace based on regular expressions to remove only selectors marked "UNUSED".

I used Grant Skinners excellent regexr ( http://www.regexr.com/ ) to output the expression:

UNUSED ([\ s \ S] [^}] *})

Tools that can use this method include, for example, Notepad ++ or Netbeans.

Hope this helps,

Sebastian

0
source

All Articles