File tree Expand file tree Collapse file tree 2 files changed +22
-3
lines changed
Expand file tree Collapse file tree 2 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,11 @@ const parser = (css) => {
1313 const parseAtRule = ( at ) => {
1414 if ( / b r a n d / . test ( at . params ) ) {
1515 if ( at . parent . type === 'atrule' ) {
16- splits . push ( `@${ at . parent . name } ${ at . parent . params } {` ) ;
17- splits . push ( at . toString ( ) ) ;
18- splits . push ( '}' ) ;
16+ if ( ! / b r a n d / . test ( at . parent . params ) ) {
17+ splits . push ( `@${ at . parent . name } ${ at . parent . params } {` ) ;
18+ splits . push ( at . toString ( ) ) ;
19+ splits . push ( '}' ) ;
20+ }
1921 } else {
2022 splits . push ( `${ at . parent . selector } {` ) ;
2123 splits . push ( at . toString ( ) ) ;
Original file line number Diff line number Diff line change 9393 expect ( x . splits [ 1 ] ) . to . equal ( 'div span span { color: brand-color(c4); }' ) ;
9494 } ) ;
9595 } ) ;
96+
97+ it ( 'does not unwrap doubly nested brand mixins' , function ( ) {
98+ const sassString = `
99+ body {
100+ margin: 0;
101+
102+ @include brand(foo) {
103+ @include brand-text();
104+ }
105+ }
106+ ` ;
107+ const parsed = parse ( sassString ) ;
108+
109+ parsed . then ( x => {
110+ expect ( x . splits [ 1 ] ) . to . equal ( '@include brand(mozo) {\n @include brand-text();\n }' ) ;
111+ } ) ;
112+ } ) ;
96113} ) ;
You can’t perform that action at this time.
0 commit comments