Skip to content

feat: consume-tokens example + stdlib sitecheck CI#10

Open
Pattermesh wants to merge 1 commit into
mainfrom
pattermesh/brand-usage-example-ci
Open

feat: consume-tokens example + stdlib sitecheck CI#10
Pattermesh wants to merge 1 commit into
mainfrom
pattermesh/brand-usage-example-ci

Conversation

@Pattermesh

Copy link
Copy Markdown
Contributor

What

Two additions to the brand kit, both vanilla / zero-framework:

1. A worked consumer example — examples/consume-tokens/

The canonical "drop tokens.css in and you're on-brand" reference. A small settlement-monitor app (header, metric cards, status table, button row, alert) built purely from the published var(--*) custom properties. It imports only tokens.css — no page.css, no component library — and every rule in its own thin stylesheet reaches for a token first. Linked from the root use section and added as a tile in the components dashboard (pages/index.html).

2. A static-site checker + CI — tools/sitecheck.py, .github/workflows/sitecheck.yml

A pure-stdlib Python checker (no dependencies) that walks every .html file and asserts:

  • well-formed — markup parses, exactly one <!doctype>, every non-void element that opens also closes;
  • links resolve — every relative href/src and in-page / cross-page #fragment points at something that exists on disk (external http/mailto/// links are out of scope);
  • tokens wired — any page using var(--token) must <link> a stylesheet that resolves to tokens.css (directly or via a sibling sheet that pulls it in) — the one bug a design-system site must never ship.

The check functions return problem lists so they're unit-testable. tools/test_sitecheck.py has 27 pytest cases (good- and bad-case per check) plus a gate asserting the real tree is clean. The workflow runs the checker CLI then pytest on push/PR.

Tests

$ python3 tools/sitecheck.py
sitecheck: 16 file(s) OK — well-formed, links resolve, tokens wired

$ python3 -m pytest tools/test_sitecheck.py -q
27 passed

Verified the gate has teeth: deliberately breaking the example's tokens.css link makes sitecheck.py exit 1 with broken-link, unresolved-stylesheet, and tokens-not-wired errors.

🤖 Generated with Claude Code

Add the canonical "drop tokens.css in and you're on-brand" reference and a
zero-dependency checker that guards the static site on push/PR.

- examples/consume-tokens/: a small settlement-monitor app built purely from
  the published var(--*) tokens — imports only tokens.css, no page.css, no
  component library. Linked from the root "use" section and the components
  dashboard.
- tools/sitecheck.py: pure-stdlib checker — HTML well-formedness (tag balance
  + single doctype), internal-link integrity (relative href/src + in-page and
  cross-page fragments resolve on disk), and tokens-wired (any page using
  var(--token) must link a stylesheet that resolves to tokens.css).
- tools/test_sitecheck.py: 27 pytest cases, good- and bad-case per check, plus
  a gate that asserts the real tree is clean.
- .github/workflows/sitecheck.yml: runs the checker CLI then pytest on push/PR.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants