-
Hello, I am currently utilizing Tailwind CSS within a Chrome extension (using React, with Vite), specifically for a widget that embeds at the bottom of websites. However, I've observed that the Tailwind styles seem to influence not just my widget, but also the global styles of the websites it's embedded on. This results in unwanted style changes on the host website and leads to issues within my widget's appearance. I'm seeking a method to restrict the scope of Tailwind's styles strictly to my widget component, ensuring no interference with the parent website. While I'm aware that an iframe could provide a solution, I'd prefer to find an approach that doesn't rely on it. Any guidance on achieving this would be greatly appreciated. Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
If you rely on Tailwind preflight or other styles generated in the base or component layers, consider having a PostCSS plugin that runs after Tailwind CSS that scopes all rules to that of the widget. Otherwise, you could configure a |
Beta Was this translation helpful? Give feedback.
-
Using tailwind prefixes is less ideal because every class I write must have the prefix, which is kind of annoying. |
Beta Was this translation helpful? Give feedback.
-
I think I got it :)
inside plugins in "postcss.config.js" |
Beta Was this translation helpful? Give feedback.
I think I got it :)
inside plugins in "postcss.config.js"