parcel-bundler / lightningcss

An extremely fast CSS parser, transformer, bundler, and minifier written in Rust.
https://lightningcss.dev
Mozilla Public License 2.0
6.54k stars 189 forks source link

Nesting spec update #806

Open mdmoreau opened 2 months ago

mdmoreau commented 2 months ago

Noticed a change to the nesting spec and was hoping it could get updated here. Should help when using something like mixins, as it better maintains declaration order. Thanks!

spec: https://drafts.csswg.org/css-nesting-1/#mixing similar postcss-nesting update: https://github.com/csstools/postcss-plugins/wiki/PostCSS-Preset-Env-10 current demo: https://lightningcss.dev/playground/index.html#%7B%22minify%22%3Afalse%2C%22customMedia%22%3Afalse%2C%22cssModules%22%3Afalse%2C%22analyzeDependencies%22%3Afalse%2C%22targets%22%3A%7B%22chrome%22%3A6225920%7D%2C%22include%22%3A0%2C%22exclude%22%3A0%2C%22source%22%3A%22article%20%7B%5Cn%20%20color%3A%20green%3B%5Cn%20%20%26%20%7B%20color%3A%20pink%3B%20%7D%5Cn%20%20color%3A%20red%3B%5Cn%7D%22%2C%22visitorEnabled%22%3Afalse%2C%22visitor%22%3A%22%7B%5Cn%20%20Color(color)%20%7B%5Cn%20%20%20%20if%20(color.type%20%3D%3D%3D%20'rgb')%20%7B%5Cn%20%20%20%20%20%20color.g%20%3D%200%3B%5Cn%20%20%20%20%20%20return%20color%3B%5Cn%20%20%20%20%7D%5Cn%20%20%7D%5Cn%7D%22%2C%22unusedSymbols%22%3A%5B%5D%2C%22version%22%3A%22local%22%7D (pink should be before red)

mdmoreau commented 1 month ago

Additional details on the change: https://web.dev/blog/css-nesting-cssnesteddeclarations