-
-
Notifications
You must be signed in to change notification settings - Fork 144
CSS imported in layout is global regardless of the layout #752
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think it's simply unsupported. @Aslemammad thoughts? Currently, we simply use Vite to collect CSS styles, so it's like SPA. |
I feel like this could be a pretty powerful pattern to support! |
Seems simple to support https://vitejs.dev/config/build-options.html#build-csscodesplit |
Thanks for the link. I'm not sure if it's that simple, because Waku supports RSC without SSR. But, we should definitely improve the CSS handling and code splitting for styles is something that should be addressed. |
It would be interesting to experiment with React 19 style hoisting instead of importing css through vite. https://react.dev/reference/react-dom/components/style |
Yes, that would be interesting. It's not on the roadmap explicitly, but something we should investigate. Feel free to experiment. |
As I understand, there are two approaches.
For 1, it's already working if we use I hope someone can help this. |
For me, I used CSS Modules (https://vite.dev/guide/features.html#css-modules)
so, I just added declare module "*.module.css" {
const classes: { readonly [key: string]: string };
export default classes;
} |
That's what I did too. Yours seems better. Would mind opening a PR? |
To update the cssmodules example or to include it in waku itself? |
Simply change this file only: https://github.com/wakujs/waku/blob/main/examples/04_cssmodules/src/types.d.ts |
I think it's a different issue. Meanwhile, suggesting css modules would be a workaround. |
Related #752 --------- Co-authored-by: Daishi Kato <[email protected]>
I have the following
I have some global styles I want to only apply on
some-route/
and notouter-route/
. I tried to move them to just that layout that applies tosome-route/
but the CSS is present on all pagesThe text was updated successfully, but these errors were encountered: