public function doProcessFile($file, $replace = false) { $optimizedContent = JSMin::minify(file_get_contents($file)); if ($replace) { return parent::replaceFile($file, $optimizedContent); } else { return $optimizedContent; } }
public function doProcessFile($file, $replace = false) { $optimizedContent = Minify_CSS_Compressor::process(file_get_contents($file)); if ($replace) { return parent::replaceFile($file, $optimizedContent); } else { return $optimizedContent; } }
public function doProcessFile($file, $replace = false) { if (!function_exists('curl_init')) { throw new RuntimeException('PHP CURL support must be enabled to use this driver'); } $content = file_get_contents($file); $ch = curl_init(self::SERVICE_URL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, 'output_info=compiled_code&output_format=text&compilation_level=SIMPLE_OPTIMIZATIONS&js_code=' . urlencode($content)); $optimizedContent = curl_exec($ch); curl_close($ch); if ($replace) { return parent::replaceFile($file, $optimizedContent); } else { return $optimizedContent; } }
public function doProcessFile($file, $replace = false) { if (!function_exists('curl_init')) { throw new RuntimeException('PHP CURL support must be enabled to use the Google Closure Compiler API driver'); } $content = file_get_contents($file); $ch = curl_init(self::SERVICE_URL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, 'output_info=compiled_code&output_format=text&compilation_level=SIMPLE_OPTIMIZATIONS&js_code=' . urlencode($content)); $optimizedContent = curl_exec($ch); if (200 != ($httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE))) { throw new RuntimeException(sprintf('The Google Closure Compiler API returned an HTTP %d error: %s', $httpCode, $optimizedContent)); } curl_close($ch); if ($replace) { return parent::replaceFile($file, $optimizedContent); } else { return $optimizedContent; } }