File tree 3 files changed +7
-4
lines changed
3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
1
## 0.4.9
2
2
3
- * No user-visible changes .
3
+ * Add support for parsing the ` @if ` and ` @else ` rules .
4
4
5
5
## 0.4.8
6
6
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ describe('an @else rule', () => {
17
17
it ( 'has no expression' , ( ) =>
18
18
expect ( node . elseCondition ) . toBeUndefined ( ) ) ;
19
19
20
- it ( 'has matching params' , ( ) => expect ( node . params ) . toBe ( '' ) ) ;
20
+ it ( 'has empty params' , ( ) => expect ( node . params ) . toBe ( '' ) ) ;
21
21
22
22
it ( 'has empty nodes' , ( ) => expect ( node . nodes ) . toEqual ( [ ] ) ) ;
23
23
} ) ;
@@ -86,7 +86,7 @@ describe('an @else rule', () => {
86
86
it ( 'has an expression' , ( ) =>
87
87
expect ( node . elseCondition ) . toBeUndefined ( ) ) ;
88
88
89
- it ( 'has matching params' , ( ) => expect ( node . params ) . toBe ( '' ) ) ;
89
+ it ( 'has empty params' , ( ) => expect ( node . params ) . toBe ( '' ) ) ;
90
90
91
91
it ( 'has a child node' , ( ) => {
92
92
expect ( node . nodes ) . toHaveLength ( 1 ) ;
Original file line number Diff line number Diff line change @@ -208,11 +208,14 @@ const visitor = sassInternal.createStatementVisitor<Statement | Statement[]>({
208
208
visitFunctionRule : inner => new FunctionRule ( undefined , inner ) ,
209
209
visitIfRule : inner => {
210
210
const rules : Statement [ ] = [ new IfRule ( undefined , inner ) ] ;
211
+
212
+ // Skip `inner.clauses[0]` because it's already used by `new IfRule()`.
211
213
for ( let i = 1 ; i < inner . clauses . length ; i ++ ) {
212
214
rules . push ( new ElseRule ( undefined , inner , inner . clauses [ i ] ) ) ;
213
215
}
214
- if ( inner . lastClause )
216
+ if ( inner . lastClause ) {
215
217
rules . push ( new ElseRule ( undefined , inner , inner . lastClause ) ) ;
218
+ }
216
219
return rules ;
217
220
} ,
218
221
visitIncludeRule : inner => new IncludeRule ( undefined , inner ) ,
You can’t perform that action at this time.
0 commit comments