stylesheet

Function stylesheet 

Source
pub fn stylesheet(styles: &Styles) -> String
Expand description

The stylesheet a program’s pages need, and nothing else.

docs/104 §104.4’s first sentence, mechanised: “beck build walks the typed tree, collects the class strings that reach a class=, and emits the sheet. No false positives, no false negatives across a module boundary, and no configuration.” classes is the walk and this is the sheet.

What it contains, in order:

  1. A preflight. Beck’s own, and small — a browser’s defaults disagree with every utility that sets a margin. It is not Tailwind’s, which is the delivery mechanism’s opinionated global sheet rather than the design system §104.4 takes, and §104.4 says which rules it has.
  2. The theme tokens the rules read, and only those: a page using one colour defines one colour. This is the half docs/08 §8.5.4’s styling item 5 makes a Beck value; here it is Tailwind’s defaults.
  3. @property for the internals the rules read, with the fallback Tailwind ships for browsers that do not register custom properties.
  4. One rule per class the program can carry, in name order — which puts p-4 before px-2 because - sorts before a letter, so a shorthand loses to the longhand that follows it, which is the order a reader expects and the order Tailwind’s own sheet has.

A class the program carries that is not a utility contributes nothing: it is the program’s own name, and the compiler has nothing to say about what it should look like.