Skip to content

Commit b5b171c

Browse files
authored
Migrate postcss-nesting (#40)
* Migrate postcss-nesting * Migrate postcss-nesting
1 parent cc8511c commit b5b171c

29 files changed

+387
-549
lines changed

plugins/postcss-nesting/.bin/test-lint.js

-38
This file was deleted.

plugins/postcss-nesting/.bin/test-tape.js

-91
This file was deleted.

plugins/postcss-nesting/.bin/test.js

-29
This file was deleted.

plugins/postcss-nesting/.editorconfig

-15
This file was deleted.

plugins/postcss-nesting/.github/workflows/test.yml

-33
This file was deleted.

plugins/postcss-nesting/.gitignore

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
node_modules
2-
postcss-7-nesting
3-
postcss-8-nesting
42
dist
53
package-lock.json
64
yarn.lock
75
*.log*
86
*.result.css
9-
.*
10-
!.bin
7+
*.result.css.map
118
!.editorconfig
12-
!.github
139
!.gitignore
14-
!.npmrc
1510
!.rollup.js
1611
!.tape.js
1712
!.travis.yml
13+
!.github

plugins/postcss-nesting/.npmrc

-2
This file was deleted.

plugins/postcss-nesting/.rollup.js

-66
This file was deleted.

plugins/postcss-nesting/.tape.js

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
const mixinPluginRule = () => {
2+
return {
3+
postcssPlugin: 'mixin',
4+
AtRule: {
5+
mixin(node) {
6+
node.replaceWith('& .in{ &.deep { color: blue; }}')
7+
},
8+
},
9+
}
10+
}
11+
12+
mixinPluginRule.postcss = true
13+
14+
const mixinPluginRuleWithNesting = () => {
15+
return {
16+
postcssPlugin: 'mixin-with-nesting',
17+
plugins: [mixinPluginRule(), require('./dist/index.cjs')()]
18+
}
19+
}
20+
21+
mixinPluginRuleWithNesting.postcss = true
22+
23+
const mixinPluginDeclaration = () => {
24+
return {
25+
postcssPlugin: 'mixin',
26+
AtRule: {
27+
mixin(node) {
28+
node.replaceWith('color: blue;')
29+
},
30+
},
31+
}
32+
}
33+
34+
mixinPluginDeclaration.postcss = true
35+
36+
const mixinPluginDeclarationWithNesting = () => {
37+
return {
38+
postcssPlugin: 'mixin-with-nesting',
39+
Once: () => {
40+
throw new Error('bork');
41+
},
42+
plugins: [mixinPluginDeclaration(), require('./dist/index.cjs')()]
43+
}
44+
}
45+
46+
mixinPluginDeclarationWithNesting.postcss = true
47+
48+
module.exports = {
49+
'basic': {
50+
message: 'supports basic usage',
51+
},
52+
'complex': {
53+
message: 'supports complex entries',
54+
},
55+
'direct': {
56+
message: 'supports direct usage',
57+
},
58+
'at-rule': {
59+
message: 'supports at-rule usage',
60+
},
61+
'container': {
62+
message: 'supports nested @container',
63+
},
64+
'document': {
65+
message: 'supports nested @document',
66+
},
67+
'media': {
68+
message: 'supports nested @media',
69+
},
70+
'supports': {
71+
message: 'supports nested @supports',
72+
},
73+
'empty': {
74+
message: 'removes empty rules',
75+
},
76+
'ignore': {
77+
message: 'ignores invalid entries',
78+
},
79+
'mixin-declaration': {
80+
message: 'supports other visitors (mixin declaration)',
81+
plugin: mixinPluginDeclarationWithNesting
82+
},
83+
'mixin-rule': {
84+
message: 'supports other visitors (mixin rule)',
85+
plugin: mixinPluginRuleWithNesting
86+
},
87+
'spec-examples': {
88+
message: 'supports all spec examples',
89+
},
90+
};

0 commit comments

Comments
 (0)