Bonsai CSS – an ultralight utility-first CSS framework
bonsaicss.com
bonsaicss.com
Oh I know. We'll call it Cascading Style Sheets.
If I'm going to have to add `style="--bg:cyan"` all over the place, I'd rather just stick with the standard `style="background:cyan"` so that my dear colleagues and I can avoid having to learn and relearn whatever cute names each next microframework comes up with.
In my experience, functional CSS can be great if it's limited to a very small set of very common properties with a smallish set of common values. But this seems much closer to how we did in the 90s back when it was a free-for-all...
This hurts accessibility, customiseabilty and future proofing.
A long time ago there was a proposal spec for styling pseudo classes via inline styles, but it didn't take.
<div style="--mb:1.5rem; --maxw:400px;">
example
</div>
is associated with this stylesheet: [style*="--mb:"] {
margin-bottom: var(--mb) !important;
}
[style*="--maxw:"] {
max-width: var(--maxw) !important;
}
That can't be very efficient. Also, to make this work all the rules are !important.I think I'll stick with Tailwind, this doesn't seem to offer any improvement over it, and in fact might be much slower than using classes or ID have heavily optimised lookup paths.
EDIT: I think the "killer feature" this has compared to other functional libraries is that you're not constrained to any value scale: you can have a margin of 1.37px if you want, without having to update your CSS. Personally I think being constrained to a scale, and making arbitrary values harder to use, is actually helpful.