The problem

I need to redesign CSS structure of an existing web application. It supports "branding" — it's got 5 different look-and-feels. Each user has one assigned brand, based on the company they work for.

我需要重新设计现有Web应用程序的CSS结构。它支持“品牌” - 它有5种不同的外观和感觉。每个用户都有一个指定品牌,基于他们所服务的公司。

Currently we have a bunch of complicated CSS files that have long since broken out of control. A typical web page includes 4 style sheets, templating system decides which ones. This means a page reload is needed to switch brands.

目前我们有一堆复杂的CSS文件,这些文件早已失控。典型的网页包括4个样式表,模板系统决定哪些样式表。这意味着需要重新加载页面才能切换品牌。

A new CSS system should:

一个新的CSS系统应该:

  1. Be based on CSS scripting, preferably LESS, or SaSS.
  2. 基于CSS脚本,最好是LESS或SaSS。

  3. Use only one style sheet in the target environment.
  4. 在目标环境中仅使用一个样式表。

  5. Allow brands to be e̲a̲s̲i̲l̲y̲ switched without page reloading.
  6. 允许在不重页加载的情况下轻松切换品牌。

My idea

With the help of CSS scripting, define general and brand-based rules:

在CSS脚本的帮助下,定义一般和基于品牌的规则:

p {
    /* general settings */
}

#brand1 p {
    /* include/redefine general settings, add some for brand1 */
}

#brand2 p {
    /* include/redefine general settings, add some for brand2 */
}

Create an outer <div> for the whole body and switch its id with JavaScript to brand1, brand2, etc. This way I don't need to script CSS in any way, just switch the "context" of all elements with one line of JavaScript.

为整个身体创建一个外部

并将其id用JavaScript转换为brand1,brand2等。这样我就不需要以任何方式编写CSS脚本,只需用一行切换所有元素的“上下文”。 JavaScript的。

更多相关文章

  1. python解压zip脚本
  2. 使用python脚本配置zabbix发送报警邮件
  3. 见证历史!Python或将取代VBA,成为Excel官方脚本语言!
  4. 解决Linux下运行Python脚本显示“: 没有那个文件或目录”的问题
  5. 通过Excel / VBA运行Python脚本
  6. 利用Dnspod api批量更新添加DNS解析【python脚本】
  7. 是否可以在没有安装铁python的PC上运行编译的铁python脚本?
  8. python脚本下载并解码MNIST数据遇到的问题
  9. 从另一个Python脚本调用Python脚本的最佳方式是什么?

随机推荐

  1. Android: 向最强看齐, 反编译 植物大战僵
  2. Android(安卓)使用RecycleView制作头像堆
  3. Setting up Automatic NDK Builds in Ecl
  4. Android 经典资料分享大家一起顶
  5. 用Gradle 构建你的android程序
  6. Android(安卓)打开淘宝商品详情
  7. 我的android 第一天-电话拨号器
  8. Android的消息处理机制(深入源码)
  9. android 无界面service编程
  10. 实现Android Studio JNI开发C/C++使用__a