Define parent class, so you don't need use prefix #2446
Replies: 6 comments 3 replies
-
That's great, because I can use it in Wordpress Guttemberg without affecting the rest of BackOffice just in the text editor. |
Beta Was this translation helpful? Give feedback.
-
Since tailwind uses postCSS to generate the CSS files, you could use the |
Beta Was this translation helpful? Give feedback.
-
not work for mee ??????? |
Beta Was this translation helpful? Give feedback.
-
This is how I got to work thanks to @jovisjoseph's suggestion. Install the package: Then in your module.exports = {
plugins: [
require('tailwindcss/nesting'),
require('tailwindcss'),
require("postcss-prefix-selector")({
prefix: '.parent-class',
}),
]
} |
Beta Was this translation helpful? Give feedback.
-
That is a good idea! By having a parent class, you can ensure that the styles from Tailwind are scoped to a specific area and do not interfere with any other styles in the project. This approach can also make the code easier to maintain and understand, as the styles are organized in a clear and consistent way. However, it's important to note that this approach might not be suitable for all projects. In some cases, it may be preferable to use the prefix method to avoid conflicts with existing styles, or to enforce a strict namespacing convention. Ultimately, the choice between the two approaches will depend on the specific needs and constraints of the project. Dinar Guru |
Beta Was this translation helpful? Give feedback.
-
just add an important selector https://tailwindcss.com/docs/configuration#selector-strategy
will create classes like
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello guys!
I would like to use tailwind in a project that already exists, to avoid conflicts I understand we can use prefix, but this makes writing the classes quite long.
I have some snippets, and I use visual code plugin for tailwind, so I can code soooo fast, anyway stop working for me when I use prefix :P
Could be nice in config file add a "parent class", for example:
So you can use tailwind as allways for example : mr-12 not tw-mr-12, you only need a parent class.
What you think guys ?
Beta Was this translation helpful? Give feedback.
All reactions