juice icon indicating copy to clipboard operation
juice copied to clipboard

Cannot use nested rules

Open firdiansyah26 opened this issue 3 years ago • 5 comments

Hi, I want to ask about nested rules in CSS. I found the error like this [vite] Internal server error: Cannot read properties of undefined (reading 'match'). Maybe someone here has found this problem or maybe it has been solved? Please tell me, thank you! *the following code is an example image image

firdiansyah26 avatar Jul 22 '22 02:07 firdiansyah26

This is not supported by juice (I think) Juice relies on a library called mensch, and uses the method parse to handle the CSS string. And this has no support in it.

Maybe we can catch the CSS string with & references before mensch.parse and format it correctly. What do you think @jrit ?

filoscoder avatar Feb 04 '23 13:02 filoscoder

I open a PR for this "bug". Please check it out @jrit

https://github.com/Automattic/juice/pull/442

filoscoder avatar Feb 04 '23 17:02 filoscoder

Juice only handles CSS syntax, anything else like SASS should be first compiled to CSS.

cossssmin avatar Sep 29 '25 10:09 cossssmin

Nesting is supported in plain CSS, it's not exclusive to preprocessors anymore. This issue should not be closed on the grounds that this is not CSS syntax. It has been supported by all major browsers since late 2023.

CSSWG specification

d-eisenga avatar Oct 30 '25 08:10 d-eisenga

Fair enough, I've reopened the issue. Feel free to work on a PR (with tests and documentation) that implements support for this in Juice, I will be happy to review 👍

cossssmin avatar Oct 30 '25 09:10 cossssmin