Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I organize my ASP.Net themes and common CSS files

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.

like image 493
Josh Avatar asked Sep 21 '08 01:09

Josh


People also ask

How do I organize HTML and CSS files?

One approach is to place HTML files inside a folder, CSS files inside a folder and javascript file inside a js folder and include the javascript files from the js folder into the main HTML page. Many years ago I created a simple site and thought that organizing by page made sense.

Where should CSS files be stored?

One solution is put all the css file in root-directory/css , while quite a few websites use hierarchical directory like '/skin' '/global' etc. The others choose a quite differential way using links like http://sstatic.net/stackoverflow/all.css?v=5fc0e3026fcc (this is the stackoverflow way).

How many CSS files should I have?

you should keep only one css file. Let me tell you in simple one line, once your website loads in client web browser the static resource can be cached that helped your website to boost and number of web request can be reduce when user browse multiple pages of your website. Save this answer.


2 Answers

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.

like image 200
sontek Avatar answered Oct 20 '22 00:10

sontek


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

like image 33
Sam Avatar answered Oct 19 '22 22:10

Sam