Split the game page into partials under src/, assembled into one index.html at build

site/index.html (900 KB of HTML, CSS and JS in one file) becomes src/: a shell
(src/index.html), styles/ and game/, concatenated in path order by
scripts/lib/page.js. The assembled page is byte-identical to the old file, so
load time and in-game performance are unchanged.

- scripts/build.js replaces build.sh (same env vars, same output)
- npm run dev: a zero-dependency dev server that assembles on every request
- tests assemble the page in memory; npm test runs every tests/*.test.js
- perf-bench takes --base-ref to build a git ref's page
- scripts/legacy/split-index-html.js is the splitter, kept for older branches
This commit is contained in:
Frederic Jung 2026-10-27 10:05:56 +01:00
parent 295e68cc46
commit 67a40942b4
No known key found for this signature in database
113 changed files with 5584 additions and 5195 deletions

38
src/styles/50-tablet.css Normal file
View file

@ -0,0 +1,38 @@
/* Tablets in landscape (and small laptops): slimmer side panels, a tuck-away left panel and
bigger touch targets so the map keeps some room in the middle. */
@media (min-width:761px) and (max-width:1200px){
#left{width:272px}
#panel{width:336px}
#left.closed{display:none}
#leftToggle{display:flex;position:fixed;left:max(12px,env(safe-area-inset-left,0px));bottom:calc(env(safe-area-inset-bottom,0px) + 14px);z-index:4}
#leftToggle[hidden]{display:none}
}
@media (min-width:761px) and (max-width:1366px) and (pointer:coarse){
.b.sm{min-height:32px;padding:5px 11px}
.tabs button{min-height:40px}
.speed button{min-height:34px}
}
/* Mid-size screens: keep the HUD on one row so it never wraps over the side panels. */
@media (min-width:761px) and (max-width:1360px){
#hud{gap:6px}
.chip{padding:3px 8px}
.speed{gap:3px;padding:4px 5px}
.speed button{min-width:29px;font-size:12px}
}
@media (min-width:761px) and (max-width:1180px){
.hide-md{display:none !important}
.brand .val{font-size:17px}
.chip .val{font-size:17px}
}
@media (min-width:761px) and (max-width:960px){
.brand>div{display:none}
.brand .caret{display:none}
.chip .lbl{font-size:9px}
.chip .val{font-size:15px}
}
@media (min-width:761px) and (max-width:1040px){
.hide-md2{display:none !important}
.speed button{min-width:26px;height:28px;font-size:11.5px}
.chip{padding:2px 7px}
}