Find all CSS styles used on website

Dave Anderson picture Dave Anderson · Nov 25, 2009 · Viewed 8k times · Source

I have a DotNetNuke skin that has a single CSS file over 3,500 lines long. It contains styles for YUI, Telerik, Cluetip as well as the actual customisation of the site. The old developers just kept adding styles and never cleaned up the old unused ones.

I want to cleanup the file and get it to a more managable size. I first thought about scanning through the code base but this is 5,500 files with a mixture of CSS applied in the .aspx, .ascx and .cs files as well as jQuery aplying styles sometimes from generated code and sometimes from js files. Some styles are applied with class selectors and others with id selectors.

Is there a way I can easily check just which styles the website actually needs across all of its pages? Is there some crawler that could do this?

Answer

Ikke picture Ikke · Nov 25, 2009

For firefox there is an add-in called dust-me-selectors. If you provide a sitemap, it will find all unused css styles.