[ehnancement] Add custom CSS file by reference (instead of importing it's content)

Bug #854744 reported by Mekk
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Won't Fix
Undecided
Unassigned

Bug Description

It would be nice, if I could convince Calibre to preserve some of my custom CSS by reference (= by <link rel>, CSS @import, link in content.opf, or whatever), without interpreting it (or even accessing) at the conversion time.

Currently, as I see, Calibre is flattening my custom CSS (set by Conversion/Common Options/Extra CSS) by loading it's content into my HTML files. Even @import directives are handled this way. This is generally good way as it makes books self-contained, but …

… but I'd like to keep single CSS file on my device (Sony Reader), reference it from my books, and be able to edit CSS in one place (say - to replace font, or margins), impacting all books on the device, without the need to reconvert them.

To have this, I'd just need to add /Data/Custom/my_stylesheet.css as custom stylesheet for my books (via @import or <link rel>, note - this path is reader specific, I am using Sony PRS-600 which internally mounts books directory as /Data), then edit this stylesheet as /media/READER/Custom/my_stylesheet.css whenever reader is connected to my PC.

Maybe the most general option to solve would be to provide "Raw CSS" conversion option which would allow one to specify any kind of CSS passed as-is to the output file. I'd use it to specify @import, but it could work in other unexpected cases.

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 854744

calibre's conversion pipeline is designed to flatten css. It needs to do this
to function correctly. If you want some CSS to always appear in your output
files, simply paste it into the Extra CSS box in conversion settings.

 status wontfix

Changed in calibre:
status: New → Won't Fix
Revision history for this message
Mekk (marcin-kasperski) wrote :

If I paste @import, it is dropped… OK, I will try to describe the problem in other way.

Some readers (including my Sony PRS-600) fail to provide a way to configure default font(s). Therefore the only way to impact book styling is to embed appropriate CSS inside .epub. Still, this is troublesome as such CSS is copied to every book separately, so any change must be reflected in all books separately. Having sth like @import("/predefined/location/on/the/reader.css") in every book would let me edit this CSS file once and impact all books simultaneously, at least for calibre-generated ebooks it would work as replacement for reader configuration.

In Calibre pipeline it could be considered not the aspect of a book, but aspect of EPUB output generator - a snippet of CSS added to epub on the very end of pipeline, after flattening, conversions,, etc

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.