Why doesn't this nested selector work "& > * ~ *" #581
-
When I try this it will give me an error that is saying const spaceX = style({
selectors: {
"& > * ~ *": {
marginLeft: `calc(${value} * calc(1 - ${fallbackVar(spaceXReverseVar, "0")}))`,
marginRight: `calc(${value} * ${fallbackVar(spaceXReverseVar, "0")})`,
}
}
})
I don't want to have global styles, I want it refer to its own className, Is it possible to do it |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
I don't think this library supports it |
Beta Was this translation helpful? Give feedback.
-
Well, it turns out the Vite plugin is not that simple… First of all, I wanted to make it work on a project which uses macaron, but the latter is actually completely circumventing the Vite modules transformation pipeline and reads the files directly on disk. For the kind of task I want to do, this means it becomes a nightmare and I don’t want to fight that much to hack that somewhat surprising design (is it due to Vite’s limitations?) So then, since I had an implementation ready to be tested, I switched back to pure Vanilla Extract, and my plugin did work. However, this handles only the very simple cases, which are the ones I mostly use. During the implementation, I discovered that there are many edge cases. So it’s feasible, but at a cost of:
Looking for alternatives, I had a look at panda. It has a decent DX regarding the integration in projects. On the APIs side, it fixes the main issues:
However it does have some pain points too:
The use of utility classes is another nightmare. This breaks semantics:
CSS is not just about “making it work”, the structure of the rules sets should not be a black box to the end user: developers should design them not just to make styling work, but also to allow end user customization/interaction. There, panda allows only half of it (the ”make it work” half). But if all those constraints are ok for you, panda may be a relevant alternative to Vanilla Extract here. |
Beta Was this translation helpful? Give feedback.
I don't think this library supports it