Skip to content

Commit 2e74034

Browse files
committed
Merge rules within combined @layer blocks
1 parent 44b4641 commit 2e74034

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6481,7 +6481,7 @@ mod tests {
64816481
}
64826482
}
64836483
@layer foo {
6484-
.bar {
6484+
.foo {
64856485
background: #fff;
64866486
}
64876487
@@ -6494,9 +6494,6 @@ mod tests {
64946494
@layer foo {
64956495
.foo {
64966496
color: red;
6497-
}
6498-
6499-
.bar {
65006497
background: #fff;
65016498
}
65026499

src/rules/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,13 @@ impl<'i> CssRuleList<'i> {
305305
if let Some(CssRule::LayerBlock(last_style_rule)) = rules.last_mut() {
306306
if last_style_rule.name == layer.name {
307307
last_style_rule.rules.0.extend(layer.rules.0.drain(..));
308-
}
309-
if layer.minify(context, parent_is_unused)? {
308+
last_style_rule.minify(context, parent_is_unused)?;
310309
continue;
311310
}
312311
}
312+
if layer.minify(context, parent_is_unused)? {
313+
continue;
314+
}
313315
}
314316
CssRule::MozDocument(document) => document.minify(context)?,
315317
CssRule::Style(style) => {

0 commit comments

Comments
 (0)