本文整理汇总了PHP中CssMin::setVerbose方法的典型用法代码示例。如果您正苦于以下问题:PHP CssMin::setVerbose方法的具体用法?PHP CssMin::setVerbose怎么用?PHP CssMin::setVerbose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CssMin
的用法示例。
在下文中一共展示了CssMin::setVerbose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compileStyleSheet
public function compileStyleSheet($source, $dest)
{
$buffer = $this->getStyleVariables();
$buffer .= JFile::read(JPATH_ROOT . '/' . $source);
if (JDEBUG || KunenaFactory::getConfig()->debug) {
$filters = array('ImportImports' => array('BasePath' => JPATH_ROOT . '/' . dirname($source)), 'RemoveComments' => false, 'RemoveEmptyRulesets' => false, 'RemoveEmptyAtBlocks' => false, 'ConvertLevel3Properties' => true, 'ConvertLevel3AtKeyframes' => array('RemoveSource' => false), 'Variables' => true, 'RemoveLastDelarationSemiColon' => false);
$plugins = array('Variables' => true, 'ConvertFontWeight' => false, 'ConvertHslColors' => false, 'ConvertRgbColors' => false, 'ConvertNamedColors' => false, 'CompressColorValues' => false, 'CompressUnitValues' => false, 'CompressExpressionValues' => false);
CssMin::setVerbose(1);
$tokens = CssMin::minify($buffer, $filters, $plugins, false);
$buffer = new CssKunenaFormatter($tokens, "\t");
} else {
$filters = array('ImportImports' => array('BasePath' => JPATH_ROOT . '/' . dirname($source)), 'RemoveComments' => true, 'RemoveEmptyRulesets' => true, 'RemoveEmptyAtBlocks' => true, 'ConvertLevel3Properties' => true, 'ConvertLevel3AtKeyframes' => array('RemoveSource' => false), 'Variables' => true, 'RemoveLastDelarationSemiColon' => true);
$plugins = array('Variables' => true, 'ConvertFontWeight' => true, 'ConvertHslColors' => true, 'ConvertRgbColors' => true, 'ConvertNamedColors' => true, 'CompressColorValues' => true, 'CompressUnitValues' => false, 'CompressExpressionValues' => true);
$buffer = CssMin::minify($buffer, $filters, $plugins);
}
$buffer = preg_replace_callback('/url\\(([^\\)]+)\\)/u', array($this, 'findUrl'), $buffer);
JFile::write(JPATH_ROOT . '/' . $dest, $buffer);
unset($tokens, $buffer, $filters, $plugins);
return $dest;
}
示例2: prepareCss
private function prepareCss($css)
{
$filters = array("RemoveComments" => false, "RemoveEmptyRulesets" => true, "RemoveEmptyAtBlocks" => true, "ConvertLevel3AtKeyframes" => false, "ConvertLevel3Properties" => true, "Variables" => false, "RemoveLastDelarationSemiColon" => false);
CssMin::setVerbose(true);
$css = str_replace("-moz-box-sizing", "box-sizing", $css);
$css = CssMin::minify($css, $filters);
$parts = explode('}', $css);
$new_css = '';
foreach ($parts as $part) {
$bits = explode(';', $part);
foreach ($bits as $bit) {
if (strlen($bit)) {
$pre = '';
if (strpos($bit, 'linear-gradient') !== false) {
if (strpos($bit, '{') !== false) {
$bs = explode('{', $bit);
$bit = $bs[1];
$pre = $bs[0] . '{';
}
$bit .= ";\n" . str_replace('linear-gradient(', '-webkit-linear-gradient(top, ', $bit);
}
if (strpos($bit, 'transform') !== false) {
if (strpos($bit, '{') !== false) {
$bs = explode('{', $bit);
$bit = $bs[1];
$pre = $bs[0] . '{';
}
$bit .= ";\n" . str_replace('transform', '-webkit-transform', $bit);
}
$new_css .= $pre . $bit . ";\n";
}
}
$new_css .= "}\n";
}
$tokens = CssMin::parse($new_css);
return new CssOtbsFormatter($tokens, " ", 32);
}