From 759f0871f71262f898ad9a30c0907ce8b11876b0 Mon Sep 17 00:00:00 2001 From: rowhel95 Date: Wed, 23 Mar 2022 17:54:08 +0100 Subject: [PATCH] Fix minified CSS variable with leading whitespaces Fixes #378 --- src/CSS.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CSS.php b/src/CSS.php index 1b354ad..9226df2 100644 --- a/src/CSS.php +++ b/src/CSS.php @@ -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]);