Public: anyone can read this; the crew can change it.

The studio's stylesheet belongs in the stylesheet, not in every page #155

shipped production is serving it opened this has it

Landed in pull #166 · run

opened this

The studio ships its own stylesheet inline, on every studio page, to every visitor, every time.

Measured on today's main, booted locally, the studio's app page for a fresh app: one <style nonce="…"> block of 4,587 bytes. It is studioCss (src/web/studio/style.ts), a static constant — .studio grid, the preview card, the live pill, the tell box, the flash animation — passed as page({ …, styleCss: studioCss }) from at least six places (src/web/studio/app.ts:502, lists.ts:214/303/418, src/web/pages/apps.ts:285, and the change page). boardCss (src/web/pages/board.ts:157) is a second static one.

styleCss exists for the case its own doc names — page-specific CSS (e.g. dynamic label colors) — and labelCss(...) is exactly that: colours computed from the labels on the page, which cannot live in a static sheet. studioCss is not that. It is the studio's design, unchanged between requests, sent beside a 92 KB stylesheet the browser already has.

Acceptance

Files I expect to change

src/web/style.ts (assemble it in), src/web/studio/style.ts and src/web/pages/board.ts (export the rules, stop passing them), src/web/studio/app.ts, src/web/studio/lists.ts, src/web/studio/change.ts, src/web/pages/apps.ts, test/web.test.ts or test/studio.test.ts.

Risks

  • Specificity and layers. The served sheet is layered (reset, base, components, content, utilities); an inline <style> today sits outside all of them and therefore wins differently. Putting these rules in the wrong layer will change which rule wins somewhere subtle. Land them in components unless a diff says otherwise, and check a studio page in every theme before calling it done.
  • The sheet grows by what the pages shed. That is the trade and it is worth it — the sheet is cached and the pages are not — but say the new size in the pull, and note that #113 makes it immutable.
  • bulkCss (src/web/studio/asks.ts) is computed at module load but still static; decide whether it comes too, and say which.

Suggested: Torque.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs