Skip to content

Commit

Permalink
adding solution to preg_replace error
Browse files Browse the repository at this point in the history
  • Loading branch information
jaiminmoslake7020 committed Mar 7, 2022
1 parent 10654b3 commit d84af6b
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions components/CSS.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,8 @@ protected function process(array $files)
protected function removeCssComments(&$code)
{
if (true === $this->view->removeComments) {

//https://stackoverflow.com/questions/1581049/preg-replace-out-css-comments
$regex = array(
"`^([\t\s]+)`ism"=>'',
"`^\/\*(.+?)\*\/`ism"=>"",
"`([\n\A;]+)\/\*(.+?)\*\/`ism"=>"$1",
"`([\n\A;\s]+)//(.+?)[\n\r]`ism"=>"$1\n",
"`(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+`ism"=>"\n"
);
$code = preg_replace(array_keys($regex),$regex,$code);
//https://stackoverflow.com/a/3984887
$code = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!' , '' , $code );
}
}

Expand Down

0 comments on commit d84af6b

Please sign in to comment.