Skip to content

refactor(website): unify Astro/Starlight theme and streamline site CSS & components - #440

Merged
100gle merged 3 commits into
bubbuild:mainfrom
100gle:refactor/website-polish
Dec 2, 2026
Merged

100gle merged 3 commits into
bubbuild:mainfrom
100gle:refactor/website-polish

Conversation

@100gle

@100gle 100gle commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Unifies theme state, monochrome design tokens, and layout alignment across the Astro site pages (landing, blog, 404) and Starlight docs, then cleans up redundant CSS and duplicated head/animation boilerplate.

1. Theme, Color Tokens & Layout Alignment (d600264)

  • Single dark-mode source of truth: Removed the redundant .dark class; both Astro site pages and Starlight docs now rely exclusively on html[data-theme] (with html[data-theme-pref] for zero-FOUC 3-state icon rendering).
  • Shared 3-state theme toggle: Updated ThemeToggle.astro into a single-button 3-state cycle (auto → light → dark, respecting prefers-color-scheme changes and syncing multiple toggle instances) and wired it into Starlight via components.ThemeSelect so docs and site pages share one toggle and View Transition reveal.
  • Unified OKLCH palette & layout: Mapped Starlight's --sl-color-* (including dark/light ::backdrop) directly onto the site's OKLCH semantic tokens, moved --sl-content-width: 52rem onto :root so Starlight's header search bar and two-column grid stay aligned, and added @layer base fallbacks for Expressive Code / <Tabs> variables on non-Starlight pages.
  • Typography & browser chrome: Fixed PostLayout.astro's broken 'JetBrains Mono Variable' font reference to var(--font-mono), aligned blog prose contrast with --sl-color-text, avoided system-ui fallback for Outfit on Windows CJK, added color-scheme + CJK text-autospace in @layer base, and synced <meta name="theme-color"> dynamically in favicon-theme.js.

2. CSS Inlining & site.css Boundary Split (c009ab3)

  • Inlined simple/redundant component <style> rules into Tailwind utilities across FeatureCard.astro, Hero.astro, TapeModel.astro, HookIntro.astro, and Testimonials.astro (removing <style> blocks completely from FeatureCard and Hero).
  • Moved landing-only --site-* variables (dropping 6 unused ones), .site-code-block, and .install-tabs from global.css into site.css so Starlight docs pages no longer bundle unused landing styles, while keeping shadcn tokens, .sl-markdown-content, and .pele-diagram in global.css.

3. Shared Head Assets & Viewport Loop Helper (fbd7ac9)

  • Extracted SiteHeadAssets.astro (fonts, theme-color, adaptive favicons, inline theme init, favicon-theme.js) and reused it in both BaseLayout.astro and StarlightHead.astro, removing the duplicated head array in astro.config.mjs.
  • Extracted src/lib/viewport-loop.ts (mountViewportLoop) to deduplicate inView + prefers-reduced-motion + visibilitychange + astro:page-load lifecycle boilerplate across Testimonials.astro, HookIntro.astro, and TapeModel.astro, and added a static fallback state for TapeModel.astro under reduced motion.
  • Simplified repeated table headers in TapeModel.astro.

Impacted Modules

  • website/ only (Astro config, layouts, landing/UI components, src/styles/, src/lib/viewport-loop.ts, public/favicon-theme.js, website/AGENTS.md)

Verification

  • pnpm fmt:check (oxfmt --check): 49 files passed
  • pnpm check (astro check): 0 errors, 0 warnings across 45 files
  • node --test website/scripts/pele.test.mjs: 3/3 passed
  • pnpm build (astro build): 83 static pages + Pagefind index built cleanly; verified built HTML/CSS bundles for landing, blog, EN docs, and ZH-CN docs

@100gle
100gle merged commit ee4afbd into bubbuild:main Dec 2, 2026
6 checks passed
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