Skip to content

Next: per-route critical CSS via manifest v2 (P2.15)#100

Merged
dbanksdesign merged 5 commits into
mainfrom
feat/per-route-critical-css-p2-15
Jun 17, 2026
Merged

Next: per-route critical CSS via manifest v2 (P2.15)#100
dbanksdesign merged 5 commits into
mainfrom
feat/per-route-critical-css-p2-15

Conversation

@dbanksdesign

Copy link
Copy Markdown
Collaborator

Summary

  • buildTypestylesForNext now traces each App Router page + layout chain, emits self-contained per-route CSS under app/_typestyles/routes/, and upgrades the extraction manifest to v2 with a routes map (enabled by default when app/ exists; opt out with routeCss: false).
  • Adds getRouteCss(routePath, { root }) on @typestyles/next/server and @typestyles/build-runner to read pre-extracted route CSS at request time instead of the monolithic getRegisteredCss() buffer.
  • Extends verifyTypestylesBuild with v2 manifest + per-route file checks; updates docs, next-app example verification, and changeset.

Test plan

  • pnpm --filter @typestyles/build-runner test
  • pnpm --filter @typestyles/next test
  • Run pnpm next-app build and confirm app/typestyles.manifest.json is v2 with routes entries
  • Confirm route CSS files exist under app/_typestyles/routes/

Made with Cursor

dbanksdesign and others added 5 commits June 17, 2026 11:50
Emit route-scoped stylesheets during buildTypestylesForNext and expose getRouteCss so SSR can load pre-extracted CSS per App Router route instead of the full getRegisteredCss buffer.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…ions

Co-authored-by: Cursor <cursoragent@cursor.com>
Externalize .css imports and site-root url() assets from CSS during esbuild tracing so layout imports of typestyles.css do not fail on font paths like /fonts/...

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@dbanksdesign dbanksdesign merged commit f5b9c6d into main Jun 17, 2026
6 checks passed
@dbanksdesign dbanksdesign deleted the feat/per-route-critical-css-p2-15 branch June 17, 2026 19:58
@github-actions github-actions Bot mentioned this pull request Jul 4, 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