File tree 2 files changed +18
-6
lines changed
2 files changed +18
-6
lines changed Original file line number Diff line number Diff line change 1
1
function pluginFn ( fn = ( ) => { } ) {
2
2
return {
3
- postcssPlugin : 'postcss-ng-tailwind-dark ' ,
3
+ postcssPlugin : 'postcss-ng-tailwind-in-components ' ,
4
4
Rule : fn ,
5
5
}
6
6
}
@@ -28,7 +28,10 @@ module.exports = ({parentSelector} = {}) => {
28
28
}
29
29
}
30
30
if ( hostContextCSS . length ) {
31
- rule . selectors = rule . selectors . concat ( hostContextCSS )
31
+ const clone = rule . clone ( { selectors : hostContextCSS } ) ;
32
+ // console.log(clone);
33
+ rule . parent . insertAfter ( rule , rule . clone ( { selectors : hostContextCSS } ) )
34
+ // rule.selectors = rule.selectors.concat(hostContextCSS)
32
35
}
33
36
}
34
37
} )
Original file line number Diff line number Diff line change @@ -32,24 +32,33 @@ describe('Check errors', () => {
32
32
describe ( 'PostCSS' , ( ) => {
33
33
it ( 'should add :host-context' , async ( ) => {
34
34
await run (
35
- '.dark .test {}' ,
36
- '.dark .test, :host-context(.dark) .test {}' ,
35
+ `
36
+ .test {}
37
+ .any {}
38
+ .dark .test {}
39
+ .string {}` ,
40
+ `
41
+ .test {}
42
+ .any {}
43
+ .dark .test {}
44
+ :host-context(.dark) .test {}
45
+ .string {}` ,
37
46
{ parentSelector : '.dark' }
38
47
)
39
48
} )
40
49
41
50
it ( 'should add :host-context to "some-parent-class"' , async ( ) => {
42
51
await run (
43
52
'.some-parent-class .test {}' ,
44
- ' .some-parent-class .test, :host-context(.some-parent-class) .test {}' ,
53
+ ` .some-parent-class .test {} :host-context(.some-parent-class) .test {}` ,
45
54
{ parentSelector : '.some-parent-class' }
46
55
)
47
56
} )
48
57
49
58
it ( 'should work with id "#some-parent-id"' , async ( ) => {
50
59
await run (
51
60
'#some-parent-id .test {}' ,
52
- ' #some-parent-id .test, :host-context(#some-parent-id) .test {}' ,
61
+ ` #some-parent-id .test {} :host-context(#some-parent-id) .test {}` ,
53
62
{ parentSelector : '#some-parent-id' }
54
63
)
55
64
} )
You can’t perform that action at this time.
0 commit comments