T
TanStack8mo ago
correct-apricot

Tailwind v4 on TanStack Start

Hello, has anyone managed to set up Tailwind v4 on TanStack Start? Because for me, it works in the dev environment but not in the build environment
No description
6 Replies
flat-fuchsia
flat-fuchsia8mo ago
@アラン you need to specifiy the root for tailwind to scan your classes, in your styles.css @import "tailwindcss" source("../")
modern-teal
modern-teal8mo ago
Detecting classes in source files - Core concepts
Understanding and customizing how Tailwind scans your source files.
genetic-orange
genetic-orange8mo ago
awesome thank you guys @notKamui @DiamondDragon ♥️
correct-apricot
correct-apricotOP8mo ago
thanks, I found another solution : // app/routes/__root.tsx import appCss from "../styles/styles.css?url" export const Route = createRootRoute({ head: () => ({ meta: [ { charSet: 'utf-8', }, { name: 'viewport', content: 'width=device-width, initial-scale=1', }, { title: 'TanStack Start Starter', }, ], links: [ { rel: "stylesheet", href: appCss }, ], }), component: RootComponent, notFoundComponent: () => <div>Not Found</div>, })
adverse-sapphire
adverse-sapphire8mo ago
how is that "another" solution? you still need the source set in the css file otherwise you will run into hydration errors
flat-fuchsia
flat-fuchsia8mo ago
? what do you mean "another solution", how were you importing the css before ? This is how you ARE supposed to do it, even before tailwind v4

Did you find this page helpful?