Skip to content

Overly aggressive whitespace removal when property value contains var() #5

@paulhoadley

Description

@paulhoadley

This input fragment:

border: var(--bs-border-width) solid var(--bs-border-color);

gets minimised to:

border: var(--bs-border-width)solidvar(--bs-border-color);

by this if-block in CSSMinifier.simplifyQuotesAndCaps():

} else if ((this.contents.length() > 4) && (this.contents.substring(0, 4).equalsIgnoreCase("var("))) {
	this.contents = this.contents.replaceAll("\\s", "");
}

I think perhaps the original use case was pulling whitespace from within a single call to var(), perhaps to remove the whitespace from between the name and the optional default value? Who knows—I'm just guessing.

In any case, I think a reasonable fix is to simply delete this block entirely and accept the occasional missed space reduction.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions