Skip to content

fix: declare italic ClarityCity faces and test the custom.css<->static/fonts contract - #396

Merged
mrbobbytables merged 2 commits into
mainfrom
quality/font-italic-css-assets
Sep 21, 2026
Merged

mrbobbytables merged 2 commits into
mainfrom
quality/font-italic-css-assets

Conversation

@mrbobbytables

Copy link
Copy Markdown
Member

Summary

Closes #317.

Two changes, matching the issue's recommendation:

  1. src/css/custom.css — adds 9 @font-face blocks with
    font-style: italic for the ClarityCity 100-900 weights, pointing at
    the *Italic.woff2/woff/ttf files that were already committed under
    static/fonts/ but never referenced by any @font-face. Without
    this, every <em>/*italic* on the site rendered as a browser
    synthetic oblique instead of the real italic face, and 764K of font
    files shipped on every deploy as unreachable bytes. This is option
    (a) from the issue — restoring the intended typography at no
    download cost for readers who never hit italic text — over deleting
    the files, since they were clearly committed deliberately alongside
    their upright counterparts.
  2. tests/css-assets.test.mjs — a new test-only file that reads
    every url() reference in src/css/custom.css and asserts:
    • the extraction finds a non-zero number of references (a non-vacuity
      guard: a regression in the regex cannot silently make the other
      assertions pass trivially)
    • each reference resolves to a real file under static/, compared
      case-sensitively per path segment via readdirSync (a case-only
      typo resolves on a case-insensitive developer filesystem and 404s on
      GitHub Pages)
    • every file under static/fonts/ is referenced by at least one
      @font-face in custom.css, so an orphaned font file fails the
      build instead of shipping silently

This lands as one PR rather than split in two, per the issue's own
note: the orphan-detection test is red against main until the italic
@font-face blocks exist, so the CSS change and the test that pins it
have to move together.

Verification

  • npm run test:unit — 348 tests, 344 pass. The 2 failures are in
    tests/validate-architectures.test.mjs and are pre-existing on
    main at this branch's base commit (reproduced in isolation with
    node --test tests/validate-architectures.test.mjs before this PR's
    changes were applied); unrelated to custom.css/static/fonts/.
  • npx prettier --check tests/css-assets.test.mjs src/css/custom.css — clean.
  • npm run build — succeeds; build/fonts/ contains all 54 files, and
    the only warnings emitted are pre-existing HTML-minifier diagnostics
    on /, /architectures/, /resources/ unrelated to fonts or CSS.

Checklist

  • Content speaks to end users (see CONTRIBUTING.md) — test-only/CSS change, no content
  • Commits are DCO-signed (git commit -s)
  • Site builds without new warnings

— hive: backend=copilot model=claude-sonnet-5

🐝 Hive Agent: contributor | SHA: f4335e8

…c/fonts contract

Adds 9 @font-face blocks with font-style: italic for the ClarityCity
100-900 weights, pointing at the *Italic.woff2/woff/ttf files that
were already committed under static/fonts/ but never referenced.
Without these, browsers rendered every <em>/*italic* as a synthetic
oblique instead of the real italic face, and 764K of font files
shipped on every deploy as unreachable bytes.

Adds tests/css-assets.test.mjs, which reads every url() reference in
src/css/custom.css and asserts:
- the extraction finds a non-zero number of references, so a
  regression in the regex cannot make the other assertions vacuous
- each reference resolves to a real file under static/, compared
  case-sensitively per path segment via readdirSync (a case-only
  typo resolves on a case-insensitive developer filesystem and 404s
  on GitHub Pages)
- every file under static/fonts/ is referenced by at least one
  @font-face, so an orphaned or unreferenced font file fails the
  build instead of shipping silently

Closes #317

Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>

@castrojo castrojo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: diff cleanly declares 9 italic ClarityCity faces (weights 100-900) in src/css/custom.css matching existing font files under static/fonts/, and adds unit tests in tests/css-assets.test.mjs that verify URL resolution.

Note on CI failure: The failure in 'Validate repository' is pre-existing on main due to tests/validate-architectures.test.mjs missing sourceUrl in its validRecord fixture after commit dc5fe09, unrelated to this PR's CSS/font changes.

Awaiting second/maintainer review and CI fix on main.

@mrbobbytables
mrbobbytables added this pull request to the merge queue Sep 21, 2026
Merged via the queue into main with commit c862117 Sep 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[quality] src/css/custom.css <-> static/fonts/ contract is untested; 27 italic faces (764K) shipped but never declared

2 participants