T
TanStack5mo ago
ugly-tan

Import Css

Where should I import CSS: in __root.tsx and <head> , in router.ts, or both? And what’s the difference?
5 Replies
adverse-sapphire
adverse-sapphire5mo ago
@AMIR in the __root route
No description
adverse-sapphire
adverse-sapphire5mo ago
in the head definition -> links better support for ssr i suppose import your css file as a url btw with ?url
ugly-tan
ugly-tanOP5mo ago
So is'nt there a specific reason why CSS is imported in router.ts when using a TSrouter setup? thanks
adverse-sapphire
adverse-sapphire5mo ago
because like with any regular vite SPA, it's your client JS that imports the css during hydration but here, since you need to have the url during server rendering, you cant wait for client hydration
ugly-tan
ugly-tanOP5mo ago
oh i see . thanks a lot

Did you find this page helpful?