tags:

views:

81

answers:

4

Any recommendations on a way to find what aspx files use what CSS class. Right now I have one gigantic css files and I would like to break it up into a more organized fashion simply for sake of maintainibility.

I was wondering if anything existed that could yield a report such as this css class is used in file1.aspx, file2.aspx, etc...

I guess I could write a little script to do this, but if there were any free apps out there already written, that'd be swell.

A: 

I would say that you should try to consolidate CSS into as few files as possible in order to reduce connections needed to load the CSS dependencies; this will speed up initial page load time.

You should also try to leverage a Master Page at least for common elements such as loading jQuery, CSS, etc.

Finally, I would use GREP for Windows and add it to Visual Studio as a Toolbox item to do simple text searches like this:

http://gnuwin32.sourceforge.net/packages/grep.htm

Nissan Fan
A: 

If you have the project open in visual studio, a super simple solution could be:

In visual studio: CRTL + SHIFT + F

Find what: "class={css class name}"

Look at these file types: "*.aspx"

Scozzard
+1  A: 

There are a couple of Firefox plugins that can help you. These are Page Speed from Google and Dust-Me Selectors.

Page Speed will give you a list of CSS selectors NOT used on the page you are analysing, while Dust-Me Selectors will give you that and also a report on CSS selectors that ARE being used. Both reports have their uses.

With Dust-Me Selectors you can also get it to spider a whole site and detect any selectors that are not used anywhere on the site.

Rowlf
+1  A: 

Maybe this will help:

http://www.dotnetsurfers.com/Blog/2008/10/02/RemovingUnusedCSSClassesFromYourWebApplication.aspx

The guy wrote a small utility that parses the CSS file and your application folders to determine which css classes are not being used.

Gabriel McAdams