rgrove / crass

A Ruby CSS parser that's fully compliant with the CSS Syntax Level 3 specification.
MIT License
138 stars 14 forks source link

Add support for CSS nesting #14

Open wlipa opened 6 months ago

wlipa commented 6 months ago

Native browser support for css nesting is becoming quite widespread - https://caniuse.com/css-nesting

It appears that crass ignores nested rules. Would it be possible to support the nested syntax?

rgrove commented 6 months ago

Definitely possible, but I haven't yet looked into how extensive the changes would need to be to the parser. Thanks for letting me know you'd find this valuable!

wlipa commented 6 months ago

Thanks for the reply. I was thinking of using it to write a tool to nest / un-nest CSS.

stoivo commented 1 month ago

If we implement the next css spec, should it replace the current or do we expect to have both? I think it can replace since it backward compatible.

rgrove commented 1 month ago

The changes to the parser itself (and its public API) will be significant, so I would release this as a new major version (e.g. 2.0.0). Users who need to continue using the older parser for some reason can stick with 1.x.