homepage Welcome to WebmasterWorld Guest from 54.242.18.190
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderator: open

CSS Forum

    
Software to clean up old CSS?
eWhisper




msg:4406805
 10:23 am on Jan 14, 2012 (gmt 0)

I have a few sites that have been around for a long time and the css files have grown out of control.

As the sties have moved or changed, more gets added to the css files; and its not always edited or cleaned.

So now, there are a lot of items in the CSS file that isn't used at all by the site.

Is there software (or another way) where you can load a page or several pages and the software will tell you what elements are not being used in the CSS file?

 

alt131




msg:4406809
 11:20 am on Jan 14, 2012 (gmt 0)

Welcome to css eWhisper,

There are extensions for firefox that allow you to do this in the browser if you only want to check a few pages.

One is the "Unused selectors" in Pagespeed, which is an extension to firebug. Two others are "Css Usage" (another extension to firebug which allows you to export the "cleaned" css file) and "Dustme selectors" which is a separate extension for firefox. The development of the last two has been a bit fragmented, and all three can produce "false negatives" so I'd use with care - but may be a place to start.

Edit
Just noticed the exact question was
what elements are not being used in the CSS file?
The suggested tools will identify unused css rules, which is usually the goal when trying to clean up css. But it is different from identifying HTML elements that haven't been "used" in the css. Are you sure that's what is wanted?
eWhisper




msg:4406979
 12:15 pm on Jan 15, 2012 (gmt 0)

Pagespeed is perfect; and the others look like they can help as well.

I use pagespeed all the time; but rarely for CSS - thank for pointing out that function - much appreciated.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved