Skip to content

Commit 4a3b265

Browse files
committed
css: fix calc() inlining whitespace bug
1 parent 90989ec commit 4a3b265

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

internal/css_parser/css_parser_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ func TestGradient(t *testing.T) {
811811
expectPrinted(t, code, "a {\n background: "+gradient+
812812
"(color-mix(in lab, red, green)calc(1px)calc(2px), color-mix(in lab, blue, red)calc(98%)calc(99%));\n}\n", "")
813813
expectPrintedMangle(t, code, "a {\n background: "+gradient+
814-
"(color-mix(in lab, red, green)1px2px, color-mix(in lab, blue, red)98%99%);\n}\n", "")
814+
"(color-mix(in lab, red, green) 1px 2px, color-mix(in lab, blue, red) 98% 99%);\n}\n", "")
815815
expectPrintedMinify(t, code, "a{background:"+gradient+
816816
"(color-mix(in lab,red,green)calc(1px)calc(2px),color-mix(in lab,blue,red)calc(98%)calc(99%))}", "")
817817
expectPrintedLower(t, code, "a {\n background: "+gradient+

internal/css_parser/css_reduce_calc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func (p *parser) tryToReduceCalcExpression(token css_ast.Token) css_ast.Token {
2424
result.Text = "calc"
2525
}
2626
result.Loc = token.Loc
27+
result.Whitespace = css_ast.WhitespaceBefore | css_ast.WhitespaceAfter
2728
return result
2829
}
2930
}

0 commit comments

Comments
 (0)