Skip to content

Commit

Permalink
Merge branch 'rowhel95-rowhel95-patch-1'
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasmullie committed Mar 24, 2022
2 parents dfae066 + 6fbbb74 commit acaee1b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/CSS.php
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ protected function extractCustomProperties()
// 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]);
Expand Down
11 changes: 11 additions & 0 deletions tests/css/CSSTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,17 @@ public function dataProvider()
':root{--some-var:0px}.some-class{margin-left:calc(20px + var(--some-var))}',
);

// https://github.com/matthiasmullie/minify/issues/378
$tests[] = array(
':root {
--some-var: 0px;
}
p {
margin-left: calc(20px + var(--some-var));
}',
':root{--some-var:0px}p{margin-left:calc(20px + var(--some-var))}'
);

return $tests;
}

Expand Down

0 comments on commit acaee1b

Please sign in to comment.