當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CssMin::parse方法代碼示例

本文整理匯總了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);
 }
開發者ID:rafu1987,項目名稱:scriptmergerbless,代碼行數:11,代碼來源:SplitCSS.php

示例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);
 }
開發者ID:CASHleyM,項目名稱:world-domination-summit,代碼行數:37,代碼來源:firefile.php


注:本文中的CssMin::parse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。