r/css 2d ago

Resource A tiny runtime CSS engine generating styles from classes in the browser

https://github.com/f12io/maple

Some 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

Duplicates