Skip to content

Commit acaee1b

Browse files
Merge branch 'rowhel95-rowhel95-patch-1'
2 parents dfae066 + 6fbbb74 commit acaee1b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/CSS.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ protected function extractCustomProperties()
740740
// PHP only supports $this inside anonymous functions since 5.4
741741
$minifier = $this;
742742
$this->registerPattern(
743-
'/(?<=^|[;}])(--[^:;{}"\'\s]+)\s*:([^;{}]+)/m',
743+
'/(?<=^|[;}])\s*(--[^:;{}"\'\s]+)\s*:([^;{}]+)/m',
744744
function ($match) use ($minifier) {
745745
$placeholder = '--custom-'. count($minifier->extracted) . ':0';
746746
$minifier->extracted[$placeholder] = $match[1] .':'. trim($match[2]);

tests/css/CSSTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,17 @@ public function dataProvider()
832832
':root{--some-var:0px}.some-class{margin-left:calc(20px + var(--some-var))}',
833833
);
834834

835+
// https://github.com/matthiasmullie/minify/issues/378
836+
$tests[] = array(
837+
':root {
838+
--some-var: 0px;
839+
}
840+
p {
841+
margin-left: calc(20px + var(--some-var));
842+
}',
843+
':root{--some-var:0px}p{margin-left:calc(20px + var(--some-var))}'
844+
);
845+
835846
return $tests;
836847
}
837848

0 commit comments

Comments
 (0)