postcss / postcss-nested

PostCSS plugin to unwrap nested rules like how Sass does it.
MIT License
1.15k stars 66 forks source link

Parent classes get the CSS style of the child classes if you add an extra comma #117

Closed jesse-deboer closed 3 years ago

jesse-deboer commented 3 years ago

Parent classes get the css from nested classes if you accidentally put a comma at the end. I really don't know if this should be considered to be a bug or an issue .. 😅

Please see below for an example:

.testClass {

  .childClass, .secondChildClass, {
    background:red;  
  }

}

.testClass will get a red background. This does not happen when using SCSS for example.

ai commented 3 years ago

It is a bug.

What is the output in this case?

jesse-deboer commented 3 years ago

The compiled output is the following:

.testClass .childClass, .testClass .secondChildClass, .testClass { background:red; }

ai commented 3 years ago

I think the issue should be somewhere here https://github.com/postcss/postcss-nested/blob/main/index.js#L40-L56

Can I ask you to look? I am working this week on another open-source project.

jesse-deboer commented 3 years ago

No problem @ai, I will try to look if I can fix this!

jesse-deboer commented 3 years ago

Fixed in PR #118!

ai commented 3 years ago

The fix was released in 5.0.5.

Thanks for the report and fix.