CSS generator written in Plume: rules, typed units and custom properties, serialized to CSS text.
quill add css
use css
let rule = @Rule(.card)
padding: $unit(2, rem)
color: $var(main)
end
set rule.padding *= 2
$ String(rule)
.card {padding: 4rem;color: var(--main);}Builds a selector { ... } block from a props table:
- string keys → CSS properties, names converted from
camelCasetokebab-case - numeric keys → nested rules, inserted as-is
A number bound to its unit, with arithmetic (+ - * /):
$ unit(2, "rem") + unit(1, "rem") // 3rem
$ unit(1, "px") + unit(0.5, "rem") // calc(1px + 0.5rem)
Same unit → computed value; mixed units → wrapped in calc().
A CSS custom property, emitted as --name. Used as a property value, it references the declared variable.
The css macro (used by Rule) serializes the props table to text: each value is rendered through its tostring (unit, var, ...). The whole rule is a CSS string.