File tree 2 files changed +37
-23
lines changed
2 files changed +37
-23
lines changed Original file line number Diff line number Diff line change @@ -540,31 +540,33 @@ module.exports = (options = {}) => {
540
540
} ) ;
541
541
} ) ;
542
542
} else if ( / s c o p e $ / i. test ( atRule . name ) ) {
543
- atRule . params = atRule . params
544
- . split ( "to" )
545
- . map ( ( item ) => {
546
- const selector = item . trim ( ) . slice ( 1 , - 1 ) . trim ( ) ;
547
- const context = localizeNode (
548
- selector ,
549
- options . mode ,
550
- localAliasMap
551
- ) ;
552
-
553
- context . options = options ;
554
- context . localAliasMap = localAliasMap ;
555
-
556
- if ( pureMode && context . hasPureGlobals ) {
557
- throw atRule . error (
558
- 'Selector in at-rule"' +
559
- selector +
560
- '" is not pure ' +
561
- "(pure selectors must contain at least one local class or id)"
543
+ if ( atRule . params ) {
544
+ atRule . params = atRule . params
545
+ . split ( "to" )
546
+ . map ( ( item ) => {
547
+ const selector = item . trim ( ) . slice ( 1 , - 1 ) . trim ( ) ;
548
+ const context = localizeNode (
549
+ selector ,
550
+ options . mode ,
551
+ localAliasMap
562
552
) ;
563
- }
564
553
565
- return `(${ context . selector } )` ;
566
- } )
567
- . join ( " to " ) ;
554
+ context . options = options ;
555
+ context . localAliasMap = localAliasMap ;
556
+
557
+ if ( pureMode && context . hasPureGlobals ) {
558
+ throw atRule . error (
559
+ 'Selector in at-rule"' +
560
+ selector +
561
+ '" is not pure ' +
562
+ "(pure selectors must contain at least one local class or id)"
563
+ ) ;
564
+ }
565
+
566
+ return `(${ context . selector } )` ;
567
+ } )
568
+ . join ( " to " ) ;
569
+ }
568
570
569
571
atRule . nodes . forEach ( ( declaration ) => {
570
572
if ( declaration . type === "decl" ) {
Original file line number Diff line number Diff line change @@ -1052,6 +1052,12 @@ const tests = [
1052
1052
background-color: goldenrod;
1053
1053
}
1054
1054
}
1055
+
1056
+ @scope {
1057
+ :scope {
1058
+ color: red;
1059
+ }
1060
+ }
1055
1061
` ,
1056
1062
expected : `
1057
1063
:local(.article-header) {
@@ -1081,6 +1087,12 @@ const tests = [
1081
1087
background-color: goldenrod;
1082
1088
}
1083
1089
}
1090
+
1091
+ @scope {
1092
+ :scope {
1093
+ color: red;
1094
+ }
1095
+ }
1084
1096
` ,
1085
1097
} ,
1086
1098
{
You can’t perform that action at this time.
0 commit comments