Giacomo Spettoli
Giacomo Spettoli

Reputation: 4496

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. 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. 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

Am I missing something? do you have other options or you can select which of these two is the best?

Upvotes: 8

Views: 175

Answers (1)

vangheem
vangheem

Reputation: 3293

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.

His github acct:

https://github.com/TH-code

Example theme:

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

Upvotes: 1

Related Questions