Guide
ASW is one stylesheet and a small set of rules about markup. This guide covers getting it onto a page, then the anatomy of the page itself. The reference lists every element and attribute; the examples show them rendering.
Serve the stylesheet
There is no runtime, no build step, and no JavaScript. Link the built stylesheet and write HTML:
<link rel="stylesheet" href="dist/asw.css">
Use dist/asw.min.css when bytes matter. Both files are generated from
src/; neither is ever edited by hand.
Build from source
The build is a concatenation in layer order, then a minification pass:
git clone https://github.com/trentuna/asw
cd asw
npm ci
npm run build # dist/asw.css + dist/asw.min.css
The order of the layers is the cascade contract: tokens first, then the reset, then
typography, landmarks, forms, components, navigation, data attributes, utilities, charts,
chroma, layout, landing. Changing that order changes what wins, so it lives in
package.json, in one line.
Verify a build
The unminified bundle must equal the concatenation of its sources, byte for byte. That is
cheap to check and it catches the most common mistake in a CSS repository — a committed
dist/ that no longer matches src/:
npm run build:unminified
git diff --exit-code dist/asw.css
Continuous integration runs exactly this, then the minified build, and fails on any difference.
The skeleton
A page has one job: to say what it is. The skeleton below is complete — nothing is missing, and every element in it is a word the browser already knows.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page title</title>
<link rel="stylesheet" href="dist/asw.css">
</head>
<body>
<nav data-layout="spread">…</nav>
<header data-layout="hero"><h1>Title</h1></header>
<main>
<article>
<h2>Section</h2>
<p>Prose.</p>
</article>
</main>
<footer>…</footer>
</body>
</html>
Landmarks in order
Order is not cosmetic: assistive technology and agents both read the outline first. Put the furniture where it belongs and the document explains itself.
| Order | Element | Contents |
|---|---|---|
| 1 | nav | Ways through the site. One row, few targets. |
| 2 | header | Title, standfirst, primary actions. Once per document. |
| 3 | main | The document. Everything else is furniture. |
| 4 | article | A self-contained piece with its own heading. |
| 5 | aside | Qualification, warning, digression — never the main line. |
| 6 | footer | Provenance: dates, sources, how to verify. |
Prose and measure
Long-form text gets a measure, not a container: [data-layout="prose"] sets a
readable width and centres it. Use it on the element that actually holds the prose, so
tables and figures can still break out when they must.
<article data-layout="prose">
<h1>An essay</h1>
<p>Text at the measure the stylesheet chose.</p>
</article>
Inside prose, the elements do the work: blockquote for quotation,
figure with figcaption for anything that needs a caption,
dl for terms, table for anything with two axes — which is most
assertions in technical writing.
Tokens
Every value that matters is a custom property in src/tokens.css: colours,
type families, the type scale, spacing, widths, borders. To change the look of a site,
override tokens — never selectors:
:root {
--font-ui: system-ui, sans-serif;
--font-heading: var(--font-ui);
--accent: oklch(65% 0.14 255);
}
Because the layers only reference tokens, an override reaches every element at once, and stays correct in both colour schemes.
Themes
src/themes/ holds complete token sets that sit on top of the framework:
trentuna.css and garden.css. A theme is a file of custom
properties — no selectors, no markup changes. If a theme needs to touch a selector, what it
wants is a token that does not exist yet.
Recent changes
- Document font bound on
html - The reset layer is deliberately design-agnostic and references no tokens, so nothing
set
font-familyonhtmlorbody: headings used--font-headingand controls--font-ui, while paragraphs, lists and tables inherited the browser default. Measured in a browser, body text computed toTimes New Romanbeside sans-serif headings. Typography now bindshtml { font-family: var(--font-ui) }, which is where an inherited property belongs. Both bundles were rebuilt.