Don’t split vars with numbers in them inside arbitrary values (#8091)

* Don’t mangle vars with numbers in them

* Update changelog
This commit is contained in:
Jordan Pittman 2022-04-13 09:31:10 -04:00 • committed by GitHub
parent 1d4c5c78bd
commit 34c1e36c2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 4 deletions

View file

@ -42,10 +42,16 @@ export function normalize(value, isRoot = true) {
// Add spaces around operators inside calc() that do not follow an operator
// or '('.
return value.replace(
/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g,
'$1 $2 '
)
value = value.replace(/calc\(.+\)/g, (match) => {
return match.replace(
/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g,
'$1 $2 '
)
})
// Add spaces around some operators not inside calc() that do not follow an operator
// or '('.
return value.replace(/(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([\/])/g, '$1 $2 ')
}
export function url(value) {