Skip to content
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

Issues when using nested selectors in a postcss-mixin #101

Closed
spacedawwwg opened this issue Nov 5, 2020 · 7 comments
Closed

Issues when using nested selectors in a postcss-mixin #101

spacedawwwg opened this issue Nov 5, 2020 · 7 comments

Comments

@spacedawwwg
Copy link

spacedawwwg commented Nov 5, 2020

Using: postcss@8.1.1, postcss-nested@5.0.1 and postcss-mixins@7.0.1

postcss.config.js

module.exports = { 
  plugins: [
    require('postcss-mixins'),
    require('postcss-nested'),
  ] 
};

input.css

@define-mixin test {
  color: green;

  .test-child {
    color: red;
  }
}

.test {
  @mixin test;
}

output.css

.test {
  color: green;

  .test-child {
    color: red;
  }
}

expected.css

.test {
  color: green;
}
.test .test-child {
   color: red;
}
@spacedawwwg spacedawwwg changed the title Issues when using a nested selectors in a postcss-mixin Issues when using nested selectors in a postcss-mixin Nov 5, 2020
@spacedawwwg
Copy link
Author

This seems to work fine with postcss@7.0.35, postcss-nested@4.2.3 and postcss-mixins@6.2.3

@ai
Copy link
Member

ai commented Nov 5, 2020

Here is an issue where we discussed the problem postcss/postcss-mixins#110

We need to update postcss-nested to use visitor API. Sorry, I do not have time right now. Will be glad for PR.

@spacedawwwg
Copy link
Author

Here is an issue where we discussed the problem #101 (comment)

We need to update postcss-nested to use visitor API. Sorry, I do not have time right now. Will be glad for PR.

@ai Happy to take a look. Not written a postcss plugin before - any chance of being pointed in the right direction of this visitor api?

@ai
Copy link
Member

ai commented Nov 5, 2020

To solve this issue we need to replace Once in postcss-nested to Rule/AtRule according to Step 3 in Plugin Migration guide

@dan2k3k4
Copy link

dan2k3k4 commented Nov 5, 2020

Yeah, and to rewrite the functions being used in postcss-nested, I started a bit in the other open issue (perhaps we can close that one / merge it with this one).

@spacedawwwg I provided a patch diff to help get started:

#81 (comment)

@ai
Copy link
Member

ai commented Dec 3, 2020

Fixed ec804d1.

@ai ai closed this as completed Dec 3, 2020
@ai
Copy link
Member

ai commented Dec 3, 2020

The fix was released in 5.0.2.


Sorry for long delay, but it is hard to work on big ecosystem without proper fundings. If you want to fix the source of the problem talk with manager about sponsoring open source dependencies (here is PostCSS OpenCollective).

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

No branches or pull requests

3 participants