Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you reliably track CSS usages?

My environment is Visual Studio 2010 with Resharper 6.0. I have a large website with many CSS files with many styles.

I would like to tidy these up as a lot of them are no longer used, I noticed that Resharper allows you to track usages but obviously this can miss out CSS class specifications in code-behind etc.

My only solution is to do a Find In Files in VS but obviously when you have a large amount of styles this proves too slow and cumbersome.

Has anyone had a similar predicament?

EDIT: It's worth mentioning that the site is a CMS comprising around 10,000 pages, so anything that requires browsing pages might also be a bit tricky.

like image 736
Mantorok Avatar asked Oct 31 '11 16:10

Mantorok


2 Answers

There is a firefox extension called dust me selector that does this. You enable it and then navigate to each page. It keeps track of all used css. You spit out a new css file with all the tracked css styles.

like image 89
Amir Raminfar Avatar answered Oct 07 '22 00:10

Amir Raminfar


The Web Essentials Visual Studio Extension has a BrowserLink feature which comes with a way to track unused css in your site while you browse around the site.

like image 39
mreyeros Avatar answered Oct 07 '22 01:10

mreyeros