Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.dark class applied after .group class #70

Closed
sibbng opened this issue Nov 7, 2021 · 2 comments · Fixed by #987
Closed

.dark class applied after .group class #70

sibbng opened this issue Nov 7, 2021 · 2 comments · Fixed by #987

Comments

@sibbng
Copy link
Member

sibbng commented Nov 7, 2021

Playground

I tried using unshift() method here. It works but now changes the order of pseudo-classes. It shouldn't be big deal at runtime since it doesn't matter in what order pseudo-classes are applied (afaik) I thought there might be a better way to do this.

https://github.com/antfu/unocss/blob/afbd1ed08425a9ce1180c0568b13469abfddf86b/packages/core/src/generator/index.ts#L226

@antfu
Copy link
Member

antfu commented Nov 7, 2021

I guess we could have an extra order field for handlers and sort them before applying

@sibbng
Copy link
Member Author

sibbng commented Nov 9, 2021

I guess we could have an extra order field for handlers and sort them before applying

Variants should be applied in order as they defined in class selector. Adding order property to give high priority to certain variants will limit composability of unocss. For example use cases you can look at tailwindlabs/tailwindcss#6018 Giving dark class high priority will limit .group > .dark like use cases.

My proposed solution is:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants