Skip to content

Commit ca6b724

Browse files
committed
add a multiple namespaces example to the README
1 parent ac4ff19 commit ca6b724

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

README.md

+43
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,49 @@ h1 {
6565
}
6666
```
6767

68+
### Adding multiple namespaces is also supported.
69+
70+
```javascript
71+
var postcss = require('postcss')
72+
var selectorNamespace = require('postcss-selector-namespace')
73+
74+
var output = postcss()
75+
.use(selectorNamespace({ selfSelector: ':--component', namespace: '.foo, .bar' }))
76+
.process(require('fs').readFileSync('input.css', 'utf8'))
77+
.css
78+
```
79+
80+
`input.css`
81+
```css
82+
:--component {
83+
color: black;
84+
}
85+
86+
:--component.danger {
87+
color: red;
88+
}
89+
90+
h1, .h1 {
91+
font-weight: bold;
92+
}
93+
```
94+
95+
will output the following css:
96+
97+
```css
98+
.foo, .bar {
99+
color: black;
100+
}
101+
102+
.foo.danger, .bar.danger {
103+
color: red;
104+
}
105+
106+
.foo h1, .bar .h1 {
107+
font-weight: bold;
108+
}
109+
```
110+
68111
## SCSS support
69112

70113
This plugin can also process scss files and output scss again using the

0 commit comments

Comments
 (0)