Automattic / juice

Juice inlines CSS stylesheets into your HTML source.
MIT License
3.1k stars 220 forks source link

Cannot use nested rules #403

Open firdiansyah26 opened 2 years ago

firdiansyah26 commented 2 years ago

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

filoscoder commented 1 year ago

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 commented 1 year ago

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

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