views:

849

answers:

4

I am currently working on a project where a programmer who fancied themselves a graphic designer attempted their hand at ASP.Net themes. The CSS is pretty bad, but that is another question altogether.

What I really need help with is the best way to organize ASP.Net Themes and the CSS that lies within them. Imagine that there is a directory structure that looks something like this:

  • Themes
    • Theme A
      • StyleA.css
      • Common.css
    • Theme B
      • StyleB.css
      • Common.css
    • Theme C
      • StyleC.css
      • Common.css

Each theme has a common stylesheet in it. Unfortunately the author of those style sheets managed to change only a few things here and there in each copy of Common.css. Eventually I will evaluate whether or not those changes are even necessary, but some major cleanup needs to happen first. For now just assume that the changes, ever so small, are necessary for things to look right with each theme.

I would like to know what the best practices are for using themes while also needing some common styles across your application. I want to minimize the number of AppTurns in the page load, but I really want to consolidate common styles into one place in a way that maintains the ease of themes.

+7  A: 

You should just include the standard/common css in the website and include it in the head of the masterpage instead of placing it in themes.

sontek
+1  A: 

Yes, just reference the common CSS file directly instead of putting it in the theme folders.

81bronco
A: 

But what if you have a webpage in a sub folder that uses the masterpage? Won't the page to the css file be wrong then?

Use the root operator (~/) to reference the theme (e.g. "~/styles/common.css"). I don't recall, but you may need to add runat="server" to the tag for this to work.
Jerph
+1  A: 

Hi, I have written a small article about that:

http://www.sambeauvois.be/blog/2010/01/dont-repeat-your-common-css-between-your-different-themes/

I'll complete it with more information later

Sam
This is good, I guess I had never really thought about using a different StyleSheet theme from my actual theme. I assumed they were mutually exclusive.
Josh