remix-run / remix

Build Better Websites. Create modern, resilient user experiences with web fundamentals.
https://remix.run
MIT License
29.53k stars 2.49k forks source link

[Feature]: Stylesheet Splitting Support for CSS Generators like Tailwind, WindiCSS, Twind, etc. #1804

Closed helloimalastair closed 2 years ago

helloimalastair commented 2 years ago

What is the new or updated feature that you are suggesting?

Way to enable easy automatic stylesheet splitting with Tailwind JIT, WindiCSS, Twind, or others, to allow for each page to have its own stylesheet with only the styles that are actually utilized on this page.

Why should this feature be included?

Currently, you can kind of bodge together a setup with Tailwind JIT or Windi with a separate CLI process, or something like concurrently. This is OK for smaller projects, where you have one singular style-system, and not many differences from one page to another. As your project grows, and you attempt to make it run fast and more efficiently, it may not be the best idea to have one monolithic stylesheet, but rather break it up into chunks, each of which will only be requested when it is actually needed.

sergiodxa commented 2 years ago

I think because the way Tailwind works, the larger the project the less the CSS will keep growing because most classes are already being used, so that single CSS is not a real problem, most of the time it will not change between deploys if you don't use new classes and usually the size caps on ~10kb.

If you were using another way to write CSS it may have keep growing with the UI making bigger CSS files.

chaance commented 2 years ago

We have plans to expand the scope of our compiler to include some CSS processing, but we don't know exactly what that will look like yet. Closing this for now, though we may open a new issue if and when we decide to implement something like this.