Re: [dev] Whether a css selector applies to given html surf code

From: Sagar Acharya <sagaracharya_AT_tutanota.com>
Date: Tue, 26 Oct 2021 16:48:17 +0200 (CEST)

> On Tue, Oct 26, 2021 at 07:35:01AM +0200, Sagar Acharya wrote:
>
>> I assume you mean writing css straight into html file itself. Kamitkami is not meant for css that we write. One can use if one uses 1 single style file which turns gigantic when used across many html files.
>> It's meant for using css frameworks like cirrus. I use cirrus by stanley lim and it's gigantic. I don't want most elements in the css which I include.
>> Thanking you
>> Sagar Acharya
>> https://designman.org
>>
>> Oct 26, 2021, 04:56 by nrk_AT_disroot.org:
>>
>> > On Mon, Oct 25, 2021 at 08:36:31PM +0200, Sagar Acharya wrote:
>> >
>> >> I'm making this software called kamitkami. It's a python script which takes 2 inputs foo.html and bar.css and outputs a css file named bar_foo.css which contains only the css which applies to the particular html page . This will make css extremely minimal and page loading faster.
>> >>
>> >
>> > Wouldn't it make more sense to just inline the css into the html
>> > instead? I think Dylan was doing that for K1SS.
>> > https://archive.md/dFqxv
>> >
>> > - NRK
>> >
>>
>
> Hi,
>
> One solution can be not using CSS frameworks and just write it by hand. It is
> not hard to do, creates cleaner files and improves understanding of CSS.
>
It's very hard to implement layout, break points, etc. Flexboxes are a bit difficult to handle.

> Many years ago I wrote a small snippet:
> https://www.codemadness.org/query-unused-css-rules-on-current-document-state.html
>
Nice. Today, js code would be much simpler  document.querySelector(selector_string)   in JS. I don't know how to run js code and make both communicate.

> There are also options for it in the inspectors in the browsers now.
>
> Note that in the ugly web world for example it could need some ugly event and
> execute Javascript and insert some ugly DOM element which is used in the CSS
> (so you need to manually test for that). Otherwise it would be marked as not
> used.
>
Yes, that would be very difficult. I will definitely not target that right now.

> --
> Kind regards,
> Hiltjo
>
Thanks folks.

Страхиња Радић , 
That's a bit more primitive. It can go a bit more vibrant wrt fonts, colors, break points for mobile, tablet which would still be minimal in my view. I'm approaching such simplicity from the other complex end which most people prefer, unfortunately.

Teodoro,
I typically approach suckless community with anything minimal. I get the best suggestions here. As I point out above, it can be done in 1 line in JS. I used BeautifulSoup4 and the code is complete. However, the selector detection isn't implemented well in bs4 so I'll have to improve. I checked python-gobject, js implementations like requests-html.

Thanks everyone
Sagar Acharya
https://designman.org

P.S. Kamitkami alpha is out! :D
Received on Tue Oct 26 2021 - 16:48:17 CEST

This archive was generated by hypermail 2.3.0 : Tue Oct 26 2021 - 17:00:08 CEST