本文整理汇总了PHP中CssMin::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP CssMin::parse方法的具体用法?PHP CssMin::parse怎么用?PHP CssMin::parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CssMin
的用法示例。
在下文中一共展示了CssMin::parse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init($cssData)
{
$this->parsedCSS = CssMin::parse($cssData, $plugins);
$this->countSelectors();
if ($this->selCount > $this->conf['css.']['scriptmergerBless.']['threshold'] && isset($this->conf['css.']['scriptmergerBless.']['activate']) && $this->conf['css.']['scriptmergerBless.']['activate'] == 1) {
$this->split();
} else {
$this->cssFiles[] = $cssData;
}
return array_reverse($this->cssFiles);
}
示例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);
}