File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
packages/svelte/src/compiler/phases/3-transform/css Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -333,21 +333,23 @@ function is_empty(rule) {
333
333
}
334
334
335
335
if ( child . type === 'Atrule' ) {
336
- return false ; // TODO
336
+ if ( child . block === null || child . block . children . length > 0 ) return false ;
337
337
}
338
338
}
339
339
340
340
return true ;
341
341
}
342
342
343
- /** @param {Css.Rule } rule */
343
+ /** @param {Css.Rule | Css.Atrule } rule */
344
344
function is_used ( rule ) {
345
- for ( const selector of rule . prelude . children ) {
346
- if ( selector . metadata . used ) return true ;
345
+ if ( rule . type === 'Rule' ) {
346
+ for ( const selector of rule . prelude . children ) {
347
+ if ( selector . metadata . used ) return true ;
348
+ }
347
349
}
348
350
349
- for ( const child of rule . block . children ) {
350
- if ( child . type === 'Rule' && is_used ( child ) ) return true ;
351
+ for ( const child of rule . block ? .children || [ ] ) {
352
+ if ( ( child . type === 'Rule' || child . type === 'Atrule' ) && is_used ( child ) ) return true ;
351
353
}
352
354
353
355
return false ;
You can’t perform that action at this time.
0 commit comments