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•5mo ago
@AMIR in the __root route

adverse-sapphire•5mo ago
in the head definition -> links
better support for ssr i suppose
import your css file as a url btw
with ?url
ugly-tanOP•5mo ago
So is'nt there a specific reason why CSS is imported in router.ts when using a TSrouter setup?
thanks
adverse-sapphire•5mo 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-tanOP•5mo ago
oh i see . thanks a lot