refactor(css): split style.css into ordered fragments

static/style.css was 47,530 lines. It is now nine files under static/css/:
tokens.css holds the :root custom properties, light theme and density classes,
and style-part-01..08 carry the rest in their original order. Nothing was
rewritten; every line moved verbatim and the <link> order in index.html
reproduces the original file byte for byte.

Cut points are brace-depth zero and outside block comments, so no rule or
comment is split. All 47,531 source lines are accounted for across the
fragments.

The computed-style baseline recorded before the split is reproduced exactly,
which is the evidence that the cascade is unchanged rather than an argument
that it should be.

Three things the split broke and this fixes:

- The harness self-test swapped two conflicting .attach-strip blocks inside
  style.css to prove the digest is order-sensitive. It rewrote one hardcoded
  URL, so with the file gone it silently measured an unmodified page. It now
  searches every stylesheet, rewrites whichever holds the pair, and fails
  loudly if none does.
- Four tests asserted the cache-bust token by matching /static/style.css?v=.
  They check the real invariant now, that every app stylesheet shares one
  token with app.js, through stylesheet_cache_version().
- The three panel stylesheets carried their own tokens, so a browser could
  hold half an old cascade and half a new one. All app stylesheets now bust
  together.
This commit is contained in:
Léo
2026-09-29 17:37:25 +02:00
parent 1323fab0bd
commit 03d55dfe3c
19 changed files with 47709 additions and 47556 deletions
@@ -1,7 +1,7 @@
from pathlib import Path
import re
from tests.helpers.stylesheets import app_css
from tests.helpers.stylesheets import app_css, stylesheet_cache_version
ROOT = Path(__file__).resolve().parent.parent
@@ -54,9 +54,8 @@ def test_notes_mobile_checklist_asset_versions_are_bumped():
assert re.search(r"notes\.js\?v=[A-Za-z0-9_-]+", app)
app_versions = re.findall(r"/static/app\.js\?v=([A-Za-z0-9_-]+)", html)
style_version = re.search(r"/static/style\.css\?v=([A-Za-z0-9_-]+)", html)
assert app_versions and len(set(app_versions)) == 1
assert style_version and style_version.group(1) == app_versions[0]
assert stylesheet_cache_version() == app_versions[0]
def test_drawing_edits_mark_notes_dirty_and_keep_one_gallery_image():