-
Notifications
You must be signed in to change notification settings - Fork 183
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
feat: add a module option to disable tailwind global style injection in all pages #850
feat: add a module option to disable tailwind global style injection in all pages #850
Conversation
✅ Deploy Preview for nuxt-tailwindcss ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
PR SummaryThis PR introduces several enhancements and modifications to various sections of the codebase. Here's a more simplified, non-technical summary:
|
Hey, thanks for the PR (most of the diff is linting), but for the globalInjection option, can't |
Hello @ineshbose! That really makes sense, thanks for the comment and sorry for the duplicate feature! What you think of providing a composable that injects the styles for tailwindcss manually tho? |
Yes - I'm all for scoping Tailwind CSS only where required/used, but I believe that to be against the principles of Tailwind to be a global styling utility, so there's lot of discussion in the community as far as I know. We definitely want to provide options to developers, but lot of it depends on what technical implementation we can do (trying to make an unplugin may help us in many ways, but still will need lot of R&D afaik). Moreover, Tailwind 4 also changes Tailwind from a PostCSS plugin to a Vite plugin that will change behaviour of the CSS file greatly.. it's a bit in the air at the moment, but the guide would tell you to keep your Tailwind styles global and declarative; more than that, you can set up configurations to your project, and we may add it to the module level based on need/demand. 🙂 |
That is the ultimate end goal for sure and I really have the hopes up for tailwind V4 as well! I am trying to suggest a middle ground for now in a more macro manner, I have a big CMS that has some pages that don't really use tailwind and are affected by some tailwind plugins I have like the forms reset one. Switching the import of the base tailwind styles to a runtime process would really benefit me at some google metrics and not breaking pages that are not designed to use tailwind, makes sense? |
Yes, I hear you. It makes sense, and as you pointed, we could probably make use of |
Yap! Will come with something for you to review tomorrow if you have time 🙂 |
Okey, I added the new composable using Currently from my research nitro only supports adding new public assets dirs (nuxt/nuxt#13079) which we could make an hack and add the tailwind.css to a folder adding it to nitro public assets. When using I am open to more ideas and maybe this could an use case for @pi0 to make that closed PR open again! |
Sorry i haven't went through all discussions so quickly answering here:
|
No need to say sorry here thanks for your work and making my life 10x easier! Are you against me opening a PR in Nitro supporting single file asset additions like |
I think an unplugin or a Nitro plugin hooking into
Could you elaborate on this a little for me please? With the |
I am closing this PR for now, but feel free to continue discussion. 🙂 (And if you're looking to discuss creating a PR on Nitro, please do create an issue on https://github.com/unjs/nitro, Pooya may miss this thread as he doesn't triage this module!) |
Currently when we install this module we cannot opt-out of injecting the base tailwind file in all pages of our nuxt application, this PR makes manual handling and injection of the tailwind CSS at the will of the user if it wants to control the flow!
Initially I was gonna provide a composable that helps the injection with
useHead
but I think this could another PR for now