Apply a prefix (important with a css selector) to base style (preflight) #2682
Replies: 3 comments 2 replies
-
I have this idea: #7050 |
Beta Was this translation helpful? Give feedback.
-
I agree that it would be a great feature for slowly migrating an old source code to Tailwind without too much hustle. Is there any way we could already do that with the current version that wouldn't be documented or that I didn't find ? The |
Beta Was this translation helpful? Give feedback.
-
This shows up first on search, so here's the solution that worked for me, maybe it will help someone else. @layer base {
#app {
@import "tailwindcss/preflight";
}
}
@import 'tailwindcss/utilities';
@import 'tailwindcss/theme' prefix(app); <-- for tailwind 3, configure the prefix in tailwind.config.js postcss.config.js export default {
plugins: {
'postcss-nesting': {},
},
} |
Beta Was this translation helpful? Give feedback.
-
Currently, using the important configuration option with a css selector as value will result in adding a prefix only to the utilities classes.
Is it possible to add that prefix to the base/preflight layer ?
I'm trying to integrate tailwind on a big project that has a lot of existing css, but using the default config brings side effects as the base layer impacts the existing looking.
I would like to use tailwind preflight without impacting existing styles and not have to write things like this because of browsers default styling:
Beta Was this translation helpful? Give feedback.
All reactions