简体   繁体   English

如何分裂重氮规则的理智方式?

[英]How to split Diazo rules the sane way?

I faced this problem more than once so far and now I'd like to find a perfect solution: 到目前为止,我不止一次面对这个问题,现在我想找到一个完美的解决方案:

when you have a very complex diazo theme, sooner or later you will end up splitting the rules into subsets and move them in separate files. 当您有非常复杂的重氮主题时,迟早您将最终将规则拆分为子集,并将其移动到单独的文件中。

My habit is to keep them separated based on the template to which they have to be applied. 我的习惯是根据必须应用的模板将它们分开。 Now, what's the better solution for selecting which of them should be applied? 现在,选择应采用哪种更好的解决方案是什么?

By now I've found these 2 solutions: 到目前为止,我已经找到了以下两种解决方案:

  1. you can have a list of "rules" with conditions that identify the template and then import the correct external xml. 您可以具有“规则”列表,其中包含可以识别模板并随后导入正确的外部xml的条件。 There are 2 cons here, you have to hope that all the conditions are mutually exclusive, and the "otherwise" option, which is basically another "rules" with all the previous conditions inside a not() , grows insanely huge 这里有2个弊端,您必须希望所有条件都是互斥的,并且“否则”选项(基本上是另一个带有“ not()内所有先前条件的“规则” not()会疯狂地增长
  2. you can use a xsl:choose , but it seems that this option doesn't work perfectly as the xsl:otherwise option is not always applied and I'm not sure that the construct ends on the first verified xsl:when 您可以使用xsl:choose ,但是由于xsl:otherwise选项并不总是适用,因此该选项似乎无法正常工作,并且我不确定该结构在第一个经过验证的xsl:when

Am I missing something? 我想念什么吗? do you have other options or you can select which of these two is the best? 您还有其他选择吗?还是可以选择这两者中的哪一个最好?

So this is a half answer. 所以这是一个半答案。 I'm not a diazo expert but Thijs-Code is and he's got a lot of examples of splitting out rule-sets and reusing different parts of diazo themes that you might want to take a look at. 我不是重氮专家,但Thijs-Code是,他有很多分解规则集和重用重氮主题不同部分的示例,您可能想看看。

His github acct: 他的github帐户:

https://github.com/TH-code

Example theme: 示例主题:

https://github.com/TH-code/diazotheme.purecss/blob/master/diazotheme/purecss/theme/rules.xml

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

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