sky: CSS out of the JavaScript and into sky/css/ (+ smoke test, hook fixes) #5

Merged
V merged 38 commits from skizy/css-tidy into main 2026-09-27 07:57:26 -07:00
Member

The despaghettification, part 1: CSS lives in CSS files now, not in JavaScript strings.

What changed

  • 48 of the 49 Sky.css('…' + '…') blocks (about 200,000 characters of CSS written as JavaScript strings, across 40 files) are now real stylesheets, sky/css/<name>.css, one per piece, named after its script. They're formatted like sky/sky.css, and Victor's comments are kept as CSS comments.
  • Each is linked in the <head> of every page that loads its script: right before </head>, after the page's own <style>, in script order. That's the same place and order the scripts used to add them, so the cascade is unchanged, and render-blocking links mean no flash of unstyled content.
  • Styles that took a value from the script (the eye's size and pupil, the revolver's reload time, where characters stand in the porch/kitchen/attic, the studio paper, the Claube-flick and blood cursors) now use CSS variables that the script sets at the same moment it used to add the styles.
  • The one left: the bathroom's font loader keeps Sky.css. It genuinely needs the address of Victor's font file, which only exists once he adds one.
  • Mel's room: its hotbar (room/davinv.js) links inventory.css and loot.css, since those scripts don't add their styles any more.
  • CLAUDE.md: a "Where the styles go" section (so no Claude goes back to writing CSS in strings), the smoke test under Testing, and the ?v= rule covering sky/css/. ?v= bumped to 20260927b.

Two tooling fixes found on the way (both harmless on Windows)

  • tools/hooks/pre-commit wasn't executable, so on Linux/Mac git skipped it silently, and commits made there never refreshed the lists or the catalogue. Fixed (mode +x).
  • tools/update-lists.sh now catalogues sky/css/*.css, so visitors' browsers refetch changed stylesheets. It also sorts in byte order (LC_ALL=C, capitals first, the way Git Bash already did), so a commit from Linux doesn't reshuffle every list.

How it was checked

  • tools/smoke.py (from #4, included here, so #4 can be closed): every page and room, all 8 resets, loads with no script errors or missing files.
  • --still pictures: the clock, chance, every animation and the outside world held still. Two runs of the same code are pixel-identical. Before vs after this change, all 8 resets × 13 pages match, apart from known timing jitter (the self-typing text on the sea, the clock needle, rooftop window twinkles).
  • Computed styles, old vs new, for everything a picture can't show (both custom cursors, the reload fade, the characters' positions, the paper colour, the eye): identical.
  • Each piece is its own commit, so any one can be looked at or reverted alone. While the move is only partly done, two pieces' order can differ (the rooftop's cat and pigeons vanish halfway through); the finished set restores the original order exactly.

🤖 Generated with Claude Code

The despaghettification, part 1: **CSS lives in CSS files now**, not in JavaScript strings. ## What changed - **48 of the 49 `Sky.css('…' + '…')` blocks** (about 200,000 characters of CSS written as JavaScript strings, across 40 files) are now real stylesheets, **`sky/css/<name>.css`**, one per piece, named after its script. They're formatted like `sky/sky.css`, and Victor's comments are kept as CSS comments. - Each is **linked in the `<head>`** of every page that loads its script: right before `</head>`, after the page's own `<style>`, in script order. That's the same place and order the scripts used to add them, so the cascade is unchanged, and render-blocking links mean no flash of unstyled content. - **Styles that took a value from the script** (the eye's size and pupil, the revolver's reload time, where characters stand in the porch/kitchen/attic, the studio paper, the Claube-flick and blood cursors) now use CSS variables that the script sets at the same moment it used to add the styles. - The one left: the **bathroom's font loader** keeps `Sky.css`. It genuinely needs the address of Victor's font file, which only exists once he adds one. - **Mel's room**: its hotbar (`room/davinv.js`) links `inventory.css` and `loot.css`, since those scripts don't add their styles any more. - **`CLAUDE.md`**: a "Where the styles go" section (so no Claude goes back to writing CSS in strings), the smoke test under Testing, and the `?v=` rule covering `sky/css/`. `?v=` bumped to `20260927b`. ## Two tooling fixes found on the way (both harmless on Windows) - **`tools/hooks/pre-commit` wasn't executable**, so on Linux/Mac git skipped it silently, and commits made there never refreshed the lists or the catalogue. Fixed (mode +x). - **`tools/update-lists.sh`** now catalogues `sky/css/*.css`, so visitors' browsers refetch changed stylesheets. It also sorts in byte order (`LC_ALL=C`, capitals first, the way Git Bash already did), so a commit from Linux doesn't reshuffle every list. ## How it was checked - **`tools/smoke.py`** (from #4, included here, so **#4 can be closed**): every page and room, all 8 resets, loads with no script errors or missing files. - **`--still` pictures**: the clock, chance, every animation and the outside world held still. Two runs of the same code are pixel-identical. Before vs after this change, **all 8 resets × 13 pages match**, apart from known timing jitter (the self-typing text on the sea, the clock needle, rooftop window twinkles). - **Computed styles**, old vs new, for everything a picture can't show (both custom cursors, the reload fade, the characters' positions, the paper colour, the eye): **identical**. - Each piece is its own commit, so any one can be looked at or reverted alone. While the move is only partly done, two pieces' order can differ (the rooftop's cat and pigeons vanish halfway through); the finished set restores the original order exactly. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tools/smoke.py opens every page and room (the sea, the workshop, the
rooftop, the living space and its side rooms, the template, Mel's room
and her window) in a hidden browser, in any resets you ask for, and
reports script errors and the site's own files that fail to load.
Optionally saves a picture of every page. Needs Playwright.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Holds the clock, chance, every animation (CSS, animation frames and SVG)
and the outside world (fonts, the weather, Mel's live site) still, so
two runs of the same code take identical pictures of every page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The same rules, as CSS instead of JavaScript strings, linked from each
page's head. Checked with tools/smoke.py --still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/hooks/pre-commit wasn't marked executable, so on Linux and Mac git
skipped it without a word (Windows doesn't look at that): the lists and
the catalogue were never refreshed by commits made there. And
update-lists.sh now catalogues sky/css/*.css, the new home of each
piece's styles, so visitors' browsers refetch them when they change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eye, revolver, porch, kitchen, studio, attic and claubes: the values they
took from their scripts (the eye's size and pupil, the reload time, where
a character stands, the paper colour, the custom cursors) are CSS
variables the scripts set, at the moment the styles used to be added.
Mel's room loads the hotbar itself (room/davinv.js), so it links
inventory.css and loot.css. Only the bathroom's font loader keeps
Sky.css: it needs the address of Victor's font file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
V merged commit 00044327e0 into main 2026-09-27 07:57:26 -07:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
subdomains/DaV-nky!5
No description provided.