element-plus / element-plus-nuxt-starter

🌰 A starter example for element-plus with Nuxt 3.
https://element-plus-nuxt.vercel.app
MIT License
289 stars 82 forks source link

Need help for CSS inject order example #72

Closed maicss closed 10 months ago

maicss commented 10 months ago

With a nuxt project has modules: nuxt/tailwind, nuxt/elementPlus, how to control css order? My project inject css order like: tailwind, my-project-style-sheet, element-plus.

image

Similar problem: https://stackoverflow.com/questions/76022416/nuxt-3-how-to-change-the-order-of-css-style-in-the-head https://github.com/nuxt/nuxt/issues/13874

tailwind inject order config: https://tailwindcss.nuxtjs.org/getting-started/options#injectposition but this not working

I cloned this project, add el-main tag to root if component Examlpes.vue, and add class p-0 to it:

image

expect to change el-main padding to 0, but I got: image

Can you help me with it, thanks!

YunYouJun commented 10 months ago

Of course, they may not seem like the most elegant solution.

Finally, I think you can use div directly for layout without having to stick to el-main. The internal implementation of el-main is very simple and is essentially just a div. If you have a custom situation, div is a better choice.

maicss commented 10 months ago

Attribute p-0 not working neither.

So sad. I will use div instead.

But I cannot override CSS vars, this is a massive problem.

YunYouJun commented 10 months ago

But I cannot override CSS vars, this is a massive problem.

It should be work for me to test. Can you tell me how to reproduce it?

maicss commented 10 months ago

https://codesandbox.io/p/github/maicss/element-plus-nuxt-starter/main?file=%2Fassets%2Fscss%2Findex.scss%3A18%2C8&workspaceId=5483f102-686e-45d2-9b36-a15a3415c4bc

image

YunYouJun commented 10 months ago

You need add your class .xxx instead of :root.

For performance reasons, we didn't let all variables are exposed globally.

maicss commented 10 months ago

OK, get it, thanks.