Preflight only within some container #7050
Replies: 8 comments 2 replies
-
This will be really helpful. I am using tailwind css with a Shopify Theme and don't want to break existing styles of the theme yet get the benefits of writing new styles the tailwind way. |
Beta Was this translation helpful? Give feedback.
-
This would also be helpful for me to adopt tailwind into an existing project |
Beta Was this translation helpful? Give feedback.
-
I think an easier way to do this is to enable nesting in the postcss config, disable preflight, then copy paste the preflight from node_modules into your main css file nested inside a wrapper class. Built in functionality for this would be great. |
Beta Was this translation helpful? Give feedback.
-
Yeah, it'd be really nice if this was baked into Tailwind. We use this same technique for a codebase that's still in transition to Tailwind, but it's also really useful if you want to build embeddable CSS but still use Tailwind. |
Beta Was this translation helpful? Give feedback.
-
There is already the important option with the selector strategy. |
Beta Was this translation helpful? Give feedback.
-
I'd also like to see this feature. I'm creating a Nuxt Module and I have UI components I am styling with tailwind - and using a prefix so I can compile all the css for my module down and then I wanted an option for the final application to use whatever css framework they choose without conflicts. So I wanted to add an option and then I'd be able to simply add a class to the HTML tag or to my individual components using tailwind depending on the option. |
Beta Was this translation helpful? Give feedback.
-
Thanks this plugin, it works great. https://www.npmjs.com/package/tailwindcss-scoped-preflight |
Beta Was this translation helpful? Give feedback.
-
If you're using Tailwind v4, you can check out this discussion. |
Beta Was this translation helpful? Give feedback.
-
I have an old project, where I want to have the old css untouched, and use the tailwind within some wrapped place. When I disable the preflight entirely, i have to add all the default styles to the
ul
etc. If I enable, my old style is broken.What I did, that I copied the generated preflight and added
.tw-preflight
class before all of the generated styles, to only apply the preflight within that container, and it seems to work for me nicely.I had to do it manually, but I think this would be a nice feature.
Beta Was this translation helpful? Give feedback.
All reactions