View Single Post
Old 09-06-2016, 02:17 AM   #1
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,625
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
A proposal: help sorting css stylesheet

Hi

When we try to tweak some EPUB, we frequently have to deal with long and confuse stylesheet, sometimes made up with aggregates built differently.

I wish this could be done within the Calibre Editor. There is an "unofficial" Calibre plugin about it (Sort CSS.zip).

I wish I had a menu entry in the Editor which would complement the "beautify" tool and help me sort cleanly the stylesheet. This way I could also easily spot duplicates.

The sorting rule would take care of the nature of the items and then use alphabetic order (what else?)
1. elements (with @ elements coming first like @page or @font-face). If several elements are grouped, the first one determine its alphabetic place.
If elements (like p) have several selectors, these also would be sorted out alphabetically.

2. class selectors (beginning with a coma)
If the pertaining element is left unspecified, the class selectors shoud be placed after all the elements.

3. ids (beginning with a #)

I think this way we could sort at least 95% of the content of any stylesheet

4. . ?
roger64 is offline   Reply With Quote