postcss / postcss-nested

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

:global and nested classes? #51

Closed bytasv closed 7 years ago

bytasv commented 7 years ago

Hello,

I have this snippet:

:global .theme-class {
  .button { ... }

  .button--primary { ... }
}

In browser I get this output:

.theme-class {
  .button_34hj34 { ... }

  .button--primary_34hj34 { ... }
}

Since this is not a standard CSS (nesting is not supported) this doesn't give me result that I want. What I want is output like this:

.theme-class .button_34hj34 { ... }
.theme-class .button--primary_34hj34 { ... }

I'm using webpack, with PostCSS loader

What am I doing wrong?

bytasv commented 7 years ago

It appears that I mixed and actually used postcss-nesting instead of postcss-nested...

a-x- commented 7 years ago

Hm, I cannot write like this in both postcss-nested and postcss-nesting:

:global {
  .smtg {}
}