Skip to content

Navigation Menu

Sign in
Sign up

How to use nested selectors for children? #34

Answered by Mokshit06
itsjavi asked this question in Q&A
Discussion options

I know that with vanilla-extract it is not possible to use child element selectors when defining the styles, e.g.:

export const myList = style({
 position: 'relative',
 display: 'block',
 listStyle: 'none',
 color: 'inherit',
 '> li': {
 padding: '1rem',
 }
})

Is it possible to accomplish something like this in macaron or does it have the same limitation?

Having to write a separate style for each child selector is IMHO a lot of boilerplate & an overkill, and it defeats the purpose of cascade style sheets.

You must be logged in to vote

Hey @itsjavi, yeah macaron doesn't support this right now. I looked into adding this on top of vanilla-extract, but it complicated the types and implementation quite a bit, as it would also need to set this up for nested selectors etc.

Replies: 2 comments

Comment options

Macaron is 100% Vanilla-Extract's API. Only thing Macaron adds is static extraction. So, this won't be possible unless Macaron diverges away from Vanilla-Extract which I don't see a big motive for.

You must be logged in to vote
0 replies
Comment options

Hey @itsjavi, yeah macaron doesn't support this right now. I looked into adding this on top of vanilla-extract, but it complicated the types and implementation quite a bit, as it would also need to set this up for nested selectors etc.

You must be logged in to vote
0 replies
Answer selected by Mokshit06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /