public function compressCss($content, $origFile)
{
if ($this->requireCompressMark && !preg_match('#/\\*+!#', $content)) {
// must contain /**!
return $content;
}
$this->logger->log("Compressing {$origFile}");
$data = ['code' => $content, 'type' => 'css', 'options' => ['advanced' => TRUE, 'aggressiveMerging' => TRUE, 'rebase' => FALSE, 'processImport' => FALSE, 'compatibility' => 'ie8', 'keepSpecialComments' => '1']];
$output = Helpers::fetchUrl('https://refresh-sf.herokuapp.com/css/', $error, $data);
if ($error) {
$this->logger->log("Unable to minfy: {$error}\n");
return $content;
}
$json = @json_decode($output, TRUE);
if (!isset($json['code'])) {
$this->logger->log("Unable to minfy. Server response: {$output}\n");
return $content;
}
return $json['code'];
}