Skip to content

Commit

Permalink
css: fix calc() inlining whitespace bug
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Dec 9, 2023
1 parent 90989ec commit 4a3b265
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
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 @@ -811,7 +811,7 @@ func TestGradient(t *testing.T) {
expectPrinted(t, code, "a {\n background: "+gradient+
"(color-mix(in lab, red, green)calc(1px)calc(2px), color-mix(in lab, blue, red)calc(98%)calc(99%));\n}\n", "")
expectPrintedMangle(t, code, "a {\n background: "+gradient+
"(color-mix(in lab, red, green)1px2px, color-mix(in lab, blue, red)98%99%);\n}\n", "")
"(color-mix(in lab, red, green) 1px 2px, color-mix(in lab, blue, red) 98% 99%);\n}\n", "")
expectPrintedMinify(t, code, "a{background:"+gradient+
"(color-mix(in lab,red,green)calc(1px)calc(2px),color-mix(in lab,blue,red)calc(98%)calc(99%))}", "")
expectPrintedLower(t, code, "a {\n background: "+gradient+
Expand Down
1 change: 1 addition & 0 deletions internal/css_parser/css_reduce_calc.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func (p *parser) tryToReduceCalcExpression(token css_ast.Token) css_ast.Token {
result.Text = "calc"
}
result.Loc = token.Loc
result.Whitespace = css_ast.WhitespaceBefore | css_ast.WhitespaceAfter
return result
}
}
Expand Down

0 comments on commit 4a3b265

Please # to comment.