postcss / postcss-mixins

PostCSS plugin for mixins
MIT License
466 stars 47 forks source link

Fix at-rules being processed as mixins inside of @mixin-content in function mixins #142

Closed vast closed 2 years ago

vast commented 2 years ago

Consider the following css:

@mixin foo {
  @supports (padding: max(0px)) {
    color: red;
  }
}

And the following function mixin:

function foo() {
  return { '.foo': { '@mixin-content' : {} } }
}

It breaks with the following error:

... Remove brackets from mixin. Like: @mixin name(1px) → @mixin name 1px
  4 |
  5 |     @mixin foo {
> 6 |       @supports (padding: max(0px)) {
    |       ^
  7 |         color: red;
  8 |       }

I think this happens due to this part of code:

The proposed PR attempts to fix this by running insertMixin only on @mixin and @add-mixin rules.

ai commented 2 years ago

I added a small change to speed up check 98447c7

ai commented 2 years ago

Thanks. Released in 9.0.2.

vast commented 2 years ago

I added a small change to speed up check 98447c7

Thanks!