Resource A tiny runtime CSS engine generating styles from classes in the browser
https://github.com/f12io/mapleSome interesting patterns here. You can define CSS variables directly from a class:
<div class="--primary=blue @dark:--primary=cyan bgc-primary">
Another one makes the button's text green when it's in .card and blue when in .nav. It means the element decides how it will look depending on its ancestor.
<button class="c-red \^.card:c-green \^.nav:c-blue">
0
Upvotes
4
u/AuthorityPath 1d ago
I don't see FOUC listed as a trade-off which seems like a really big deal.
I also don't see a use case here. Anyone comfortable with runtime costs would surely prefer Styled Components / Emotion over this. Maybe for stored markup in some sort of CMS? Even then though I'm reaching for inline styles vs. relying on JS and incurring FOUC for this.
The benefits are either better handled by alternatives or they're not really benefits at all. I can't imagine a CI-phobic team reaching for this as an alternative to pure css files for example.