`:global` not working as nested selector
See original GitHub issueI use postcss-nested
with postcss-global-nested
, putting nested before the global nested plugin (in order).
This works in v4+ of postcss-nested
and v5.0.1 but not in 5.0.0
or 5.0.2+
.
Given:
.selector {
:global {
h2 {
color: pink;
}
}
}
Expected:
.selector :global h2 {
color: pink;
}
Actual:
.selector :global {
h2 {
color: pink;
}
}
It’s a little baffling, because both 5.0.1
and 5.0.2
are putting out
and
css: '.selector :global h2 {\n' +
'\t\t\tcolor: pink;\n' +
'\t\t}\n',
So… 🤷♂️
Happy to put together a repro if needed.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
CSS :not() selector not working as expected (nested)
1. I think MDN is pretty clear on this point: "This selector only applies to one element; you cannot use it to exclude...
Read more >Nested function not assigning value to global variable
You solve the problem most easily by not using globals at all. It is a bad idea to use globals in the first...
Read more >Angular :host, :host-context, ::ng-deep - The Complete Guide
In this post, we will learn how the default Angular styling mechanism (Emulated Encapsulation) works under the hood, and we will also cover ......
Read more >Nested Selectors - Emotion
Sometimes it's useful to nest selectors to target elements inside the current class or React component. An example with an element selector is...
Read more >The benefits of nesting in LESS/SASS | by Vitaly Belman
In my experience however, nesting benefits outweigh the issues that were ... we should have global (not nested) selectors that define a ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Should be fixed with PostCSS 8.3.3.
Please create a new issue