Skip to content
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

CSS imported in layout is global regardless of the layout #752

Open
hipstersmoothie opened this issue Jun 19, 2024 · 6 comments
Open

CSS imported in layout is global regardless of the layout #752

hipstersmoothie opened this issue Jun 19, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@hipstersmoothie
Copy link
Contributor

I have the following

pages/
  some-route/
       _layout.tsx
  other-router/
       _layout.tsx
  _layout.tsx

I have some global styles I want to only apply on some-route/ and not outer-route/. I tried to move them to just that layout that applies to some-route/ but the CSS is present on all pages

@dai-shi
Copy link
Owner

dai-shi commented Jun 19, 2024

I think it's simply unsupported. @Aslemammad thoughts?

Currently, we simply use Vite to collect CSS styles, so it's like SPA.
We know this approach has a limitation and we may look for a new approach, but I'm not sure if route-based style will be supported with it.

@hipstersmoothie
Copy link
Contributor Author

I feel like this could be a pretty powerful pattern to support!

@hipstersmoothie
Copy link
Contributor Author

hipstersmoothie commented Jun 19, 2024

@dai-shi
Copy link
Owner

dai-shi commented Jun 19, 2024

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.

@dai-shi dai-shi added the enhancement New feature or request label Aug 17, 2024
@rmarscher
Copy link
Contributor

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

@dai-shi
Copy link
Owner

dai-shi commented Sep 12, 2024

Yes, that would be interesting. It's not on the roadmap explicitly, but something we should investigate. Feel free to experiment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants