.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / postcss-resolve-nested-selector / README.md
1 # postcss-resolve-nested-selector
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)
4
5 Given a (nested) selector in a PostCSS AST, return an array of resolved selectors.
6
7 Tested to work with the syntax of
8 [postcss-nested](https://github.com/postcss/postcss-nested)
9 and [postcss-nesting](https://github.com/jonathantneal/postcss-nesting).
10 Should also work with SCSS and Less syntax. If you'd like to help out by
11 adding some automated tests for those, that'd be swell. In fact, if you'd
12 like to add any automated tests, you are a winner!
13
14 ## API
15
16 `resolveNestedSelector(selector, node)`
17
18 Returns an array of selectors resolved from `selector`.
19
20 For example, given this JS:
21
22 ```js
23 var resolvedNestedSelector = require('postcss-resolve-nested-selector');
24 postcssRoot.eachRule(function(rule) {
25   rule.selectors.forEach(function(selector) {
26     console.log(resolvedNestedSelector(selector, rule));
27   });
28 });
29 ```
30
31 And the following CSS:
32
33 ```scss
34 .foo {
35   .bar {
36     color: pink;
37   }
38 }
39 ```
40
41 This should log:
42
43 ```
44 ['.foo']
45 ['.foo .bar']
46 ```
47
48 Or with this CSS:
49
50 ```scss
51 .foo {
52   .bar &,
53   a {
54     color: pink;
55   }
56 }
57 ```
58
59 This should log:
60
61 ```
62 ['.foo']
63 ['.bar .foo']
64 ['.foo a']
65 ```