← Back to team overview

calibre-devs team mailing list archive

Re: CSS normalization

 

On Sun, Jan 25, 2009 at 4:57 PM, Kovid Goyal <kovid@xxxxxxxxxxxxxx> wrote:

> I haven't tested the code yet.

I found a bug (which a you may have already fixed locally) where the
code is emitting empty 'class' attributes.  Fix pushed to 'staging'.

> With flattening the CSS, the only way to do this completely robustly
> would be to either have all class selectors or all id
> selectors. Either case would lead to a lot of bloat in the generated
> CSS/HTML. So I think that the current code is the best compromise.

Actually, the resulting CSS+markup is smaller.

   $ du -hs GBany2/
   1.6M    GBany2/
   $ du -hs GBflat/
   1.2M    GBflat/
   $ find GBany2/ -type f -name '*.css' | xargs cat | wc -lc
   17739  336783
   $ find GBflat/ -type f -name '*.css' | xargs cat | wc -lc
   370    5344

I'll admit this particular book is an edge case ("style" attributes on
almost every element), but the flattened CSS is smaller in almost every
case I've tried.

-Marshall



Follow ups

References