Skip to content

Commit 868dad4

Browse files
authored
fix(style): Remove the tailwind preset styles in Starlight (#181)
1 parent 13860a1 commit 868dad4

3 files changed

Lines changed: 21 additions & 9 deletions

File tree

website/src/layouts/BaseLayout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* All other layouts (LandingLayout, PostLayout, PostListLayout)
1010
* and standalone pages (404) should compose on top of this.
1111
*/
12-
import '@/styles/global.css';
12+
import '@/styles/site.css';
1313
import Footer from '@/components/Footer.astro';
1414
import NavBar from '@/components/NavBar.astro';
1515
import Icon from '@/components/ui/Icon.astro';

website/src/styles/global.css

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*
2-
* global.css — Shared stylesheet for landing, blog, AND Starlight docs.
2+
* global.css — Starlight-safe shared theme stylesheet.
33
*
44
* Loaded via:
55
* • Starlight `customCss` (docs pages)
6-
* • BaseLayout `import` (landing & blog pages)
6+
* • `site.css` import (landing & blog pages)
77
*
88
* Structure follows the official Starlight + Tailwind v4 pattern:
99
* https://starlight.astro.build/guides/css-and-tailwind/
@@ -16,8 +16,8 @@
1616
* doesn't conflict with Starlight/EC, and maps --color-accent-* /
1717
* --color-gray-* into --sl-color-* tokens automatically.
1818
* 3. Import only `tailwindcss/theme.css` and `tailwindcss/utilities.css`
19-
* in their respective layers — NOT the full `@import "tailwindcss"`
20-
* which brings in the complete Preflight reset that breaks EC.
19+
* here. Full Tailwind Preflight must stay in a separate non-Starlight
20+
* entry file or it will reset markdown content styles like list markers.
2121
* 4. Keep site-specific resets in @layer base (lowest priority).
2222
* 5. Leave Starlight overrides (--sl-font-*) unlayered so they beat
2323
* @layer starlight defaults.
@@ -41,10 +41,7 @@
4141
/* Starlight ↔ Tailwind v4 bridge */
4242
@import '@astrojs/starlight-tailwind';
4343

44-
/* Tailwind layers — preflight provides the full CSS reset (link resets,
45-
box-sizing, etc.) that landing page components rely on. It lives in
46-
@layer base so Starlight/EC styles in higher layers always win. */
47-
@import 'tailwindcss/preflight.css' layer(base);
44+
/* Tailwind layers for the Starlight-compatible entry. */
4845
@import 'tailwindcss/theme.css' layer(theme);
4946
@import 'tailwindcss/utilities.css' layer(utilities);
5047

website/src/styles/site.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* site.css — Tailwind entry for landing and blog pages.
3+
*
4+
* Starlight docs load `global.css` directly. Per the Starlight docs, full
5+
* Tailwind Preflight should be applied from a separate non-Starlight entry
6+
* so markdown content styles are not reset on documentation pages.
7+
*
8+
* Reference:
9+
* https://starlight.astro.build/guides/css-and-tailwind/#use-multiple-tailwind-configurations
10+
*/
11+
12+
@layer base, starlight, theme, components, utilities;
13+
14+
@import 'tailwindcss/preflight.css' layer(base);
15+
@import './global.css';

0 commit comments

Comments
 (0)