File tree 1 file changed +36
-15
lines changed
1 file changed +36
-15
lines changed Original file line number Diff line number Diff line change 11
11
12
12
Prefix every rule with a selector.
13
13
14
- ``` js
15
- var css = ' .a {} \n .b{}'
14
+ ## Installation
15
+
16
+ ``` console
17
+ $ npm install postcss-prefix-selector
18
+ ```
16
19
20
+ ## Usage
21
+
22
+ ``` js
17
23
var prefix = require (' postcss-prefix-selector' )
18
24
25
+ // css to be processed
26
+ var css = fs .readFileSync (" input.css" , " utf8" )
27
+
19
28
var out = postcss ().use (prefix ({
20
- prefix: ' .some-selector ' // <--- notice the traililng space!
29
+ prefix: ' .some-selector ' , // <--- notice the traililng space!
30
+ exclude: [' .c' ]
21
31
})).process (css).css
22
-
23
- console .log (out)
24
32
```
25
33
26
- ## Options
34
+ Using this ` input.css ` :
27
35
28
- It's possible to avoid prefixing some selectors with the option ` exclude ` which take an array of selectors in parameter.
36
+ ``` css
37
+ .a , .b {
38
+ color : aqua ;
39
+ }
29
40
30
- ``` js
31
- var css = ' .a {} \n html{} \n .b{}'
41
+ .c {
42
+ color : coral ;
43
+ }
44
+ ```
32
45
33
- var prefix = require ( ' postcss-prefix-selector ' )
46
+ you will get:
34
47
35
- var out = postcss (). use ( prefix ({
36
- prefix : ' .some-selector ' , // <--- notice the traililng space!
37
- exclude : [ ' html ' , ' .b ' ]
38
- })). process (css). css
48
+ ``` css
49
+ .some-selector .a , .some-selector .b {
50
+ color : aqua ;
51
+ }
39
52
40
- console .log (out)
53
+ .c {
54
+ color : coral ;
55
+ }
41
56
```
42
57
58
+
59
+ ## Options
60
+
61
+ It's possible to avoid prefixing some selectors by using the ` exclude ` option which takes an array of selectors as a parameter.
62
+
63
+
43
64
[ gitter-image ] : https://badges.gitter.im/jonathanong/postcss-prefix-selector.png
44
65
[ gitter-url ] : https://gitter.im/jonathanong/postcss-prefix-selector
45
66
[ npm-image ] : https://img.shields.io/npm/v/postcss-prefix-selector.svg?style=flat-square
You can’t perform that action at this time.
0 commit comments