~bptato/chawan#47: 
Add stylesheet-inline to [[siteconf]]

Most of the custom CSS I use is simple 1 liners for simple site-specific darkmode, and having to create a file for every one of them is too much work.

Something like "stylesheet-inline = 'CSS_HERE'" similar to "inline" in the [css] section but per [[siteconf]].

Note: I think email sending is not working for me, if you see duplicates messages of this messages, please delete them.

Status
RESOLVED CLOSED
Submitter
3bd
Assigned to
No-one
Submitted
3 months ago
Updated
a month ago
Labels
No labels applied.

bptato 3 months ago · edit

Most of the custom CSS I use is simple 1 liners for simple site-specific darkmode, and having to create a file for every one of them is too much work.

Something like "stylesheet-inline = 'CSS_HERE'" similar to "inline" in the [css] section but per [[siteconf]].

Actually, stylesheet accepts both inline and external stylesheets, so you can just use "stylesheet = 'CSS_HERE'".

That said, style config is a huge mess... [css] should have been part of [buffer], but I added it before [buffer] existed. Also, stylesheet in double-parsing its input will pointlessly try to open() inline styles.

Maybe we should add a new user-style option to buffer & siteconf that accepts inline sheets only, and scan for @import to allow for external sheets. Then the other options could be deprecated.

Note: I think email sending is not working for me, if you see duplicates messages of this messages, please delete them.

Hmm. I don't see duplicates.

(I'm replying via e-mail, so we'll see if it works at all...)

3bd 3 months ago · edit

Oh God, that's the weirdest way to do it, man.

Waiting for the user-style rewrite soon :)

~bptato REPORTED CLOSED a month ago*

Done in 55e2189a04. New syntax:

[buffer]
user-style = '''
@import 'user.css'; /* external sheet, path relative to config dir */

/* internal sheet */
a[href] { text-decoration: none !important }
a[href]:hover { text-decoration: underline !important }
'''

[[siteconf]]
host = 'example'
# works the same way as in siteconf
user-style = '''
@import 'site-example.css';

:root { background: red }
/* ... */
'''

ETA: fix semicolons...
Register here or Log in to comment, or comment via email.