Measuring a stylesheet
A framework that cannot be measured cannot be trusted, and most of what is published about size is a number with no unit of comparison attached to it. This document is the long-form test case: it exists so that the reading surface can be judged the way a reader meets it, in running text, rather than as a grid of isolated components.
What gets measured
Three figures, and they are not interchangeable. The authored file is what a contributor reads. The built file is what a browser downloads. The transfer size is what the network moves, and it is the only one of the three another project's published figure can be compared against.
The authored file
Comments carry the contrast measurements and the reasons, which is most of their value and, with no build step, also most of their bytes. Deleting them would make the number smaller and the file worse.
A fourth-level heading
Present so the scale can be seen closing rather than described as closing. By this depth the step ratio is near enough to the body size that a heading reads as emphasis instead of as a new section.
A fifth-level heading
And a sixth
Inline runs, all of which a renderer emits without a class:
strong for importance, emphasis for stress,
a marked run, small print,
a deletion next to an insertion, a variable
n, the W3C as an
abbreviation with a title, water as H2O, a square metre as
m2, inline --bs-prose-measure, the sample output
exit status 0, the keys Ctrl and C, and
a link back to the top of this section.
Lists
An unordered list, with a nested one inside the second item:
- Markers sit outside the text column, so the indent has to clear the widest marker the document can produce.
-
A nested list takes the item gap rather than the block gap:
- because it is part of its parent item
- and not a new block of its own
- Item spacing is tighter than paragraph spacing, which is what makes a list read as one object.
An ordered list, whose three-digit ordinals the indent is sized for:
- Read the contract.
- Measure the thing you are about to claim.
- Publish the number with the form it was measured in.
And a definition list:
- Authored
- The file as a contributor reads it, comments included.
- Built
- The same CSS with comments and redundant whitespace removed.
- Transfer
- What the network actually moves, which is the built file compressed.
A quotation
Contrast is a correctness property, not a preference. If a pairing cannot meet the floor, the answer is not to ship it and document the exception.
The same file also draws a pull quote, which sets larger and drops the accent edge:
A number with no unit of comparison is not a measurement.
Code
A block is <pre><code>, and it carries the three
attributes CSS cannot supply, because a box that scrolls has to be reachable
from the keyboard:
bun run size
bun run contrast
bun test test/
A table
Wrapped in the scroll region the contract asks for, which is what makes it an addressable box a keyboard can reach. At this width you are watching the other half of the answer: the cell rule lets the columns compress to fit rather than taking the page sideways, and the wrapper takes over only when a cell can no longer compress.
| File | Built | Sent | Layer |
|---|---|---|---|
| reset | 2,180 | 908 | reset |
| tokens | 6,240 | 1,904 | tokens |
| base | 4,010 | 1,377 | base |
| type | 5,880 | 1,566 | three |
A figure
An aside and a disclosure
Why there is no highlighter in this framework
Because the parser is a build-time decision and this has no build step. The file decides what seven colours mean and one rule of yours wires whichever parser you already run to them.
A claim worth a note gets one1, and so does the one after it2. Following either moves the browser to the note and marks it as the thing you were sent to.
- Measured with gzip at level 9 on the built file. Back to the text
- The roles are DPUB-ARIA, matched instead of a generator's class names so the treatment survives a change of renderer. Back to the text
Show codeHide code