1
1
# postcss-resolve-nested-selector
2
2
3
- [ ![ Build Status ] ( https://travis-ci.org/davidtheclark /postcss-resolve-nested-selector. svg?branch=master )] ( https://travis-ci.org/davidtheclark /postcss-resolve-nested-selector )
3
+ [ ![ test ] ( https://github.com/csstools /postcss-resolve-nested-selector/actions/workflows/test.yml/badge. svg )] ( https://github.com/csstools /postcss-resolve-nested-selector/actions/workflows/test.yml )
4
4
5
5
Given a (nested) selector in a PostCSS AST, return an array of resolved selectors.
6
6
7
7
Tested to work with the syntax of
8
8
[ postcss-nested] ( https://github.com/postcss/postcss-nested )
9
- and [ postcss-nesting] ( https://github.com/jonathantneal /postcss-nesting ) .
9
+ and [ postcss-nesting] ( https://github.com/csstools/postcss-plugins/tree/main/plugins /postcss-nesting ) .
10
10
Should also work with SCSS and Less syntax. If you'd like to help out by
11
11
adding some automated tests for those, that'd be swell. In fact, if you'd
12
12
like to add any automated tests, you are a winner!
@@ -22,19 +22,19 @@ For example, given this JS:
22
22
``` js
23
23
var resolvedNestedSelector = require (' postcss-resolve-nested-selector' );
24
24
postcssRoot .eachRule (function (rule ) {
25
- rule .selectors .forEach (function (selector ) {
26
- console .log (resolvedNestedSelector (selector, rule));
27
- });
25
+ rule .selectors .forEach (function (selector ) {
26
+ console .log (resolvedNestedSelector (selector, rule));
27
+ });
28
28
});
29
29
```
30
30
31
31
And the following CSS:
32
32
33
33
``` scss
34
34
.foo {
35
- .bar {
36
- color : pink ;
37
- }
35
+ .bar {
36
+ color : pink ;
37
+ }
38
38
}
39
39
```
40
40
@@ -49,10 +49,10 @@ Or with this CSS:
49
49
50
50
``` scss
51
51
.foo {
52
- .bar & ,
53
- a {
54
- color : pink ;
55
- }
52
+ .bar & ,
53
+ a {
54
+ color : pink ;
55
+ }
56
56
}
57
57
```
58
58
0 commit comments