Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jesse-deboer opened this issue Mar 2, 2021 · 6 comments · Fixed by #118
Closed

Comments

@jesse-deboer
Copy link
Contributor

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
Copy link
Member

ai commented Mar 2, 2021

It is a bug.

What is the output in this case?

@jesse-deboer
Copy link
Contributor Author

The compiled output is the following:

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

@ai
Copy link
Member

ai commented Mar 2, 2021

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
Copy link
Contributor Author

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

@jesse-deboer
Copy link
Contributor Author

jesse-deboer commented Mar 4, 2021

Fixed in PR #118!

@ai ai closed this as completed in #118 Mar 5, 2021
@ai
Copy link
Member

ai commented Mar 5, 2021

The fix was released in 5.0.5.

Thanks for the report and fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants