Fix minified CSS variable with leading whitespaces

Fixes #378
This commit is contained in:
rowhel95 2022-03-23 17:54:08 +01:00 committed by GitHub
parent dfae0665d7
commit 759f0871f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -740,7 +740,7 @@ class CSS extends Minify
// PHP only supports $this inside anonymous functions since 5.4
$minifier = $this;
$this->registerPattern(
'/(?<=^|[;}])(--[^:;{}"\'\s]+)\s*:([^;{}]+)/m',
'/(?<=^|[;}])\s*(--[^:;{}"\'\s]+)\s*:([^;{}]+)/m',
function ($match) use ($minifier) {
$placeholder = '--custom-'. count($minifier->extracted) . ':0';
$minifier->extracted[$placeholder] = $match[1] .':'. trim($match[2]);