I am using next.js with tailwind css and i somehow need some of the ready to use components in my project so i can save my time, for that i have used material-ui. My application works fine but i have got a warning message. Is is possible to use both technologies (material-ui and tailwind css) at same project, if "yes"(means if the combination of both wont effect the performance of the project or any other issue in future ) Is there is any way to remove the warning message it am showing you below
这是好的做法吗?
绝对不,您将面临许多命名冲突,这会给编译器带来许多混乱,并且优先级将不寻常
但你能做到这一点吗?
是的你可以 !!
为了避免命名冲突,请使用前缀选项 https://tailwindcss.com/docs/configuration#prefix在你的tailwind.config.js
file
// tailwind.config.js
module.exports = {
prefix: 'tw-', ???? Use your desired prefix
}
所以现在你可以使用前缀tw-
在 tailwind-css 的类名之前,它不会破坏任何现有的样式。
Note
如果您希望 tailwind 类比任何其他 css 样式获得更高的优先级,您可以设置重要的选择 https://tailwindcss.com/docs/configuration#important为真tailwind.config.js
module.exports = {
important: true,
}
Extra
要了解 css 优先级,请遵循以下步骤CSS 的优先顺序是什么? https://stackoverflow.com/questions/25105736/what-is-the-order-of-precedence-for-css
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)