简体   繁体   中英

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.

您应该在网站中包含标准/通用css,并将其包含在母版页的头部,而不是将其放在主题中。

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

是的,只需直接引用常见的CSS文件,而不是将其放在主题文件夹中。

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM