简体   繁体   English

我应该如何组织我的ASP.Net主题和常见的CSS文件

[英]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. 我目前正在开展一个项目,一个自称为平面设计师的程序员试图参与ASP.Net主题。 The CSS is pretty bad, but that is another question altogether. CSS非常糟糕,但这完全是另一个问题。

What I really need help with is the best way to organize ASP.Net Themes and the CSS that lies within them. 我真正需要帮助的是组织ASP.Net主题和其中的CSS的最佳方法。 Imagine that there is a directory structure that looks something like this: 想象一下,有一个类似于下面的目录结构:

  • Themes 主题
    • Theme A 主题A.
      • StyleA.css StyleA.css
      • Common.css Common.css
    • Theme B 主题B.
      • StyleB.css StyleB.css
      • Common.css Common.css
    • Theme C 主题C.
      • StyleC.css StyleC.css
      • Common.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 . 不幸的是,这些样式表的作者设法在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. 我想在页面加载中最小化AppTurns的数量,但我真的想以一种维护主题易用性的方式将常用样式合并到一个地方。

您应该在网站中包含标准/通用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/ 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? 那个页面到css文件会不会出错?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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