Skip to content

Commit

Permalink
Update RemoveUnusedCssBasic.php
Browse files Browse the repository at this point in the history
  • Loading branch information
BenGriffiths authored Nov 2, 2020
1 parent c697c2b commit fbfeabe
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/RemoveUnusedCssBasic.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,14 @@ protected function filterCss()
foreach ($block as $selectors => $values) {

$keep = false;
$mergedArray = array_merge($this->whitelistArray, $this->foundUsedCssElements);

foreach (explode(',', $selectors) as $selector) {

if (
(in_array(end(explode(' ', $selector)), array_merge($this->whitelistArray, $this->foundUsedCssElements))) ||
(in_array(end(explode(' ', explode(':', $selector)[0])), array_merge($this->whitelistArray, $this->foundUsedCssElements))) ||
(in_array(explode(':', $selector)[0], array_merge($this->whitelistArray, $this->foundUsedCssElements)))
(in_array(end(explode(' ', $selector)), $mergedArray)) ||
(in_array(end(explode(' ', explode(':', $selector)[0])), $mergedArray)) ||
(in_array(explode(':', $selector)[0], $mergedArray))
) {
$keep = true;
}
Expand Down

0 comments on commit fbfeabe

Please sign in to comment.