Skip to content

Commit

Permalink
fix evanw#1665: don’t remove empty @Keyframes
Browse files Browse the repository at this point in the history
  • Loading branch information
eelco committed Oct 8, 2021
1 parent 18e13bd commit 3d3f1c3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions internal/css_parser/css_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,6 @@ skipRule:
rule := rules[i]

switch r := rule.Data.(type) {
case *css_ast.RAtKeyframes:
if len(r.Blocks) == 0 {
continue
}

case *css_ast.RKnownAt:
if len(r.Rules) == 0 {
continue
Expand Down
2 changes: 1 addition & 1 deletion internal/css_parser/css_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ func TestEmptyRule(t *testing.T) {
expectPrintedMangle(t, "div {}", "")
expectPrintedMangle(t, "@media screen {}", "")
expectPrintedMangle(t, "@page { @top-left {} }", "")
expectPrintedMangle(t, "@keyframes test { from {} to {} }", "")
expectPrintedMangle(t, "@keyframes test { from {} to {} }", "@keyframes test {\n}\n")

expectPrinted(t, "$invalid {}", "$invalid {\n}\n")
expectPrinted(t, "@page { color: red; @top-left {} }", "@page {\n color: red;\n @top-left {\n }\n}\n")
Expand Down

0 comments on commit 3d3f1c3

Please sign in to comment.