Skip to content

fix(ssr): extract page-specific Astro CSS - #285

Merged
tenphi merged 3 commits into
mainfrom
codex/astro-page-css-extraction
Aug 28, 2026
Merged

fix(ssr): extract page-specific Astro CSS#285
tenphi merged 3 commits into
mainfrom
codex/astro-page-css-extraction

Conversation

@tenphi

@tenphi tenphi commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • extract artifacts emitted by every styled Astro page into one content-hashed shared stylesheet
  • extract each page strict remainder into a content-hashed page stylesheet, linked afterward as the page override cascade
  • respect Astro base, build.assets, and string/CSS-specific/fallback build.assetsPrefix values
  • fail clearly on page-relative or fragment-only CSS url() values whose targets would change after external extraction
  • cover every collector rule kind, CSP nonces, deterministic hashes, empty/shared-only cases, and production output

Fully shared pages omit an empty page asset; pages with no common artifacts receive only their page asset. The shared-base/page-override order is the extraction-mode cascade contract.

Verification

  • pnpm typecheck
  • pnpm lint
  • pnpm format / pnpm format:check
  • pnpm build
  • pnpm size
  • pnpm test (82 files, 2,180 tests)
  • pnpm check:test-only
  • pnpm knip
  • production fixture verifies a conflicting page rule overrides shared CSS in Chromium

Tested in a disposable build of tenphi.me with the branch linked locally:

  • all 8 routes emitted shared CSS first and page CSS second
  • shared asset: 89,655 bytes; page assets: 3,853–23,907 bytes
  • no inline Tasty CSS or extraction metadata remained
  • all computed styles matched the released 3.5.0 output across 4,051 rendered elements, with no browser console errors
  • the final URL validation passes all real-site styles

@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

📦 Snapshot release

Published 0.0.0-snapshot.05bff63.

pnpm add @tenphi/tasty@0.0.0-snapshot.05bff63

@tenphi
tenphi merged commit 2aeba77 into main Aug 28, 2026
6 of 7 checks passed
@github-actions github-actions Bot mentioned this pull request Aug 28, 2026
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.

1 participant