Skip to content
This repository was archived by the owner on Jun 6, 2022. It is now read-only.

Commit 5c3f711

Browse files
committed
Add smarter example with a combo
1 parent 8463e37 commit 5c3f711

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

README.md

+24-2
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ var output = postcss()
3737
console.log('\n====>Output CSS:\n', output)
3838
```
3939

40-
Or just
40+
Or just:
4141

4242
```js
4343
var output = postcss(selector())
4444
.process(css)
4545
.css
4646
```
4747

48-
input.css:
48+
input:
4949

5050
```css
5151
@custom-selector :--heading h1, h2, h3, h4, h5, h6;
@@ -97,6 +97,28 @@ a:visited {
9797
}
9898
```
9999

100+
You can even make some smart use like this:
101+
102+
```css
103+
@custom-selector :--button button, .button;
104+
@custom-selector :--enter :hover, :focus;
105+
106+
:--button:--enter {
107+
108+
}
109+
```
110+
111+
output
112+
113+
```css
114+
button:hover,
115+
.button:hover,
116+
button:focus,
117+
.button:focus {
118+
119+
}
120+
```
121+
100122
## Options
101123

102124
### `lineBreak`

test/index.js

+14
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,20 @@ h6:hover .ba--z {
219219
"should works with multilines definition"
220220
)
221221

222+
t.equal(
223+
transform(
224+
`@custom-selector :--button button, .button;
225+
@custom-selector :--enter :hover, :focus;
226+
227+
:--button:--enter {}`
228+
).css,
229+
`button:hover,
230+
.button:hover,
231+
button:focus,
232+
.button:focus {}`,
233+
"should works with collapsed custom selectors"
234+
)
235+
222236
t.equal(
223237
transform(
224238
`@custom-selector :--any .foo, .bar;

0 commit comments

Comments
 (0)