Quote:
Originally Posted by Jellby
Cleaning up CSS automatically may be considerably difficult if the stylesheet includes "advanced" selectors or rules like children, adjacent siblings, precedende, multiple classes, etc.
But there could be an option like the "flatten CSS" used by calibre, where every defined selector or combination is converted into a class (I believe that's what it does), then it's easier to "simplify", but you lose much of the charm of CSS. Nevertheless, the coding of most books needing a cleanup has no charm at all, so there's not much to lose.
|
Yes, it's more complicated than I thought at first, but I don't see a lot of it in actual use (IIRC I've seen multiple classes in one attribute in one of your books, but they don't need cleanup). As long as I don't actually change the definitions in any classes, and always leave (or add) a class in place of style="" attributes, it should be functionally identical. Advanced selectors are better left alone to start with. The first task will be to gather all definitions in one place, but I'll also have a look at how calibre flattens css.