当前位置: 首页>>代码示例>>PHP>>正文


PHP Minify_CSS_UriRewriter::prepend方法代码示例

本文整理汇总了PHP中Minify_CSS_UriRewriter::prepend方法的典型用法代码示例。如果您正苦于以下问题:PHP Minify_CSS_UriRewriter::prepend方法的具体用法?PHP Minify_CSS_UriRewriter::prepend怎么用?PHP Minify_CSS_UriRewriter::prepend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Minify_CSS_UriRewriter的用法示例。


在下文中一共展示了Minify_CSS_UriRewriter::prepend方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: minify

 /**
  * Minify a CSS string
  * 
  * @param string $css
  * 
  * @param array $options available options:
  * 
  * 'preserveComments': (default true) multi-line comments that begin
  * with "/*!" will be preserved with newlines before and after to
  * enhance readability.
  * 
  * 'prependRelativePath': (default null) if given, this string will be
  * prepended to all relative URIs in import/url declarations
  * 
  * 'currentDir': (default null) if given, this is assumed to be the
  * directory of the current CSS file. Using this, minify will rewrite
  * all relative URIs in import/url declarations to correctly point to
  * the desired files. For this to work, the files *must* exist and be
  * visible by the PHP process.
  *
  * 'symlinks': (default = array()) If the CSS file is stored in 
  * a symlink-ed directory, provide an array of link paths to
  * target paths, where the link paths are within the document root. Because 
  * paths need to be normalized for this to work, use "//" to substitute 
  * the doc root in the link paths (the array keys). E.g.:
  * <code>
  * array('//symlink' => '/real/target/path') // unix
  * array('//static' => 'D:\\staticStorage')  // Windows
  * </code>
  * 
  * @return string
  */
 static public function minify($css, $options = array()) 
 {
     require_once 'Minify/CSS/Compressor.php';
     if (isset($options['preserveComments']) 
         && !$options['preserveComments']) {
         $css = Minify_CSS_Compressor::process($css, $options);
     } else {
         require_once 'Minify/CommentPreserver.php';
         $css = Minify_CommentPreserver::process(
             $css
             ,array('Minify_CSS_Compressor', 'process')
             ,array($options)
         );
     }
     if (! isset($options['currentDir']) && ! isset($options['prependRelativePath'])) {
         return $css;
     }
     require_once 'Minify/CSS/UriRewriter.php';
     if (isset($options['currentDir'])) {
         return Minify_CSS_UriRewriter::rewrite(
             $css
             ,$options['currentDir']
             ,isset($options['docRoot']) ? $options['docRoot'] : $_SERVER['DOCUMENT_ROOT']
             ,isset($options['symlinks']) ? $options['symlinks'] : array()
         );  
     } else {
         return Minify_CSS_UriRewriter::prepend(
             $css
             ,$options['prependRelativePath']
         );
     }
 }
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:64,代码来源:CSS.php

示例2: minify

 /**
  * Minify a CSS string
  * 
  * @param string $css
  * 
  * @param array $options available options:
  * 
  * 'preserveComments': (default true) multi-line comments that begin
  * with "/*!" will be preserved with newlines before and after to
  * enhance readability.
  *
  * 'removeCharsets': (default true) remove all @charset at-rules
  * 
  * 'prependRelativePath': (default null) if given, this string will be
  * prepended to all relative URIs in import/url declarations
  * 
  * 'currentDir': (default null) if given, this is assumed to be the
  * directory of the current CSS file. Using this, minify will rewrite
  * all relative URIs in import/url declarations to correctly point to
  * the desired files. For this to work, the files *must* exist and be
  * visible by the PHP process.
  *
  * 'symlinks': (default = array()) If the CSS file is stored in 
  * a symlink-ed directory, provide an array of link paths to
  * target paths, where the link paths are within the document root. Because 
  * paths need to be normalized for this to work, use "//" to substitute 
  * the doc root in the link paths (the array keys). E.g.:
  * <code>
  * array('//symlink' => '/real/target/path') // unix
  * array('//static' => 'D:\\staticStorage')  // Windows
  * </code>
  *
  * 'docRoot': (default = $_SERVER['DOCUMENT_ROOT'])
  * see Minify_CSS_UriRewriter::rewrite
  * 
  * @return string
  */
 public static function minify($css, $options = array())
 {
     $options = array_merge(array('compress' => true, 'removeCharsets' => true, 'preserveComments' => true, 'currentDir' => null, 'docRoot' => $_SERVER['DOCUMENT_ROOT'], 'prependRelativePath' => null, 'symlinks' => array()), $options);
     if ($options['removeCharsets']) {
         $css = preg_replace('/@charset[^;]+;\\s*/', '', $css);
     }
     if ($options['compress']) {
         if (!$options['preserveComments']) {
             require_once 'Compressor.php';
             $css = Minify_CSS_Compressor::process($css, $options);
         } else {
             require_once 'CommentPreserver.php';
             require_once 'Compressor.php';
             $css = Minify_CommentPreserver::process($css, array('Minify_CSS_Compressor', 'process'), array($options));
         }
     }
     if (!$options['currentDir'] && !$options['prependRelativePath']) {
         return $css;
     }
     require_once 'UriRewriter.php';
     if ($options['currentDir']) {
         return Minify_CSS_UriRewriter::rewrite($css, $options['currentDir'], $options['docRoot'], $options['symlinks']);
     } else {
         return Minify_CSS_UriRewriter::prepend($css, $options['prependRelativePath']);
     }
 }
开发者ID:rswiders,项目名称:core,代码行数:63,代码来源:CSS.php

示例3: test_Minify_CSS_UriRewriter

function test_Minify_CSS_UriRewriter()
{
    global $thisDir;
    Minify_CSS_UriRewriter::$debugText = '';
    $in = file_get_contents($thisDir . '/_test_files/css_uriRewriter/in.css');
    $expected = file_get_contents($thisDir . '/_test_files/css_uriRewriter/exp.css');
    $actual = Minify_CSS_UriRewriter::rewrite($in, $thisDir . '/_test_files/css_uriRewriter', $thisDir);
    $passed = assertTrue($expected === $actual, 'Minify_CSS_UriRewriter : rewrite');
    if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
        echo "\n---Input:\n\n{$in}\n";
        echo "\n---Output: " . countBytes($actual) . " bytes\n\n{$actual}\n\n";
        if (!$passed) {
            echo "---Expected: " . countBytes($expected) . " bytes\n\n{$expected}\n\n\n";
        }
        // show debugging only when test run directly
        echo "--- Minify_CSS_UriRewriter::\$debugText\n\n", Minify_CSS_UriRewriter::$debugText;
    }
    Minify_CSS_UriRewriter::$debugText = '';
    $in = file_get_contents($thisDir . '/_test_files/css_uriRewriter/in.css');
    $expected = file_get_contents($thisDir . '/_test_files/css_uriRewriter/exp_prepend.css');
    $actual = Minify_CSS_UriRewriter::prepend($in, 'http://cnd.com/A/B/');
    $passed = assertTrue($expected === $actual, 'Minify_CSS_UriRewriter : prepend1');
    if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
        echo "\n---Input:\n\n{$in}\n";
        echo "\n---Output: " . countBytes($actual) . " bytes\n\n{$actual}\n\n";
        if (!$passed) {
            echo "---Expected: " . countBytes($expected) . " bytes\n\n{$expected}\n\n\n";
        }
        // show debugging only when test run directly
        echo "--- Minify_CSS_UriRewriter::\$debugText\n\n", Minify_CSS_UriRewriter::$debugText;
    }
    Minify_CSS_UriRewriter::$debugText = '';
    $in = file_get_contents($thisDir . '/_test_files/css_uriRewriter/in.css');
    $expected = file_get_contents($thisDir . '/_test_files/css_uriRewriter/exp_prepend2.css');
    $actual = Minify_CSS_UriRewriter::prepend($in, '//cnd.com/A/B/');
    $passed = assertTrue($expected === $actual, 'Minify_CSS_UriRewriter : prepend2');
    if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
        echo "\n---Input:\n\n{$in}\n";
        echo "\n---Output: " . countBytes($actual) . " bytes\n\n{$actual}\n\n";
        if (!$passed) {
            echo "---Expected: " . countBytes($expected) . " bytes\n\n{$expected}\n\n\n";
        }
        // show debugging only when test run directly
        echo "--- Minify_CSS_UriRewriter::\$debugText\n\n", Minify_CSS_UriRewriter::$debugText;
    }
    Minify_CSS_UriRewriter::$debugText = '';
    $in = '../../../../assets/skins/sam/sprite.png';
    $exp = '/yui/assets/skins/sam/sprite.png';
    $actual = Minify_CSS_UriRewriter::rewriteRelative($in, 'sf_root_dir\\web\\yui\\menu\\assets\\skins\\sam', 'sf_root_dir\\web');
    $passed = assertTrue($exp === $actual, 'Minify_CSS_UriRewriter : Issue 99');
    if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
        echo "\n---Input:\n\n{$in}\n";
        echo "\n---Output: " . countBytes($actual) . " bytes\n\n{$actual}\n\n";
        if (!$passed) {
            echo "---Expected: " . countBytes($exp) . " bytes\n\n{$exp}\n\n\n";
        }
        // show debugging only when test run directly
        echo "--- Minify_CSS_UriRewriter::\$debugText\n\n", Minify_CSS_UriRewriter::$debugText;
    }
}
开发者ID:Bhaavya,项目名称:OpenLorenz,代码行数:60,代码来源:test_Minify_CSS_UriRewriter.php

示例4: minify

 /**
  * Add line numbers in C-style comments
  *
  * This uses a very basic parser easily fooled by comment tokens inside
  * strings or regexes, but, otherwise, generally clean code will not be 
  * mangled. URI rewriting can also be performed.
  *
  * @param string $content
  * 
  * @param array $options available options:
  * 
  * 'id': (optional) string to identify file. E.g. file name/path
  *
  * 'currentDir': (default null) if given, this is assumed to be the
  * directory of the current CSS file. Using this, minify will rewrite
  * all relative URIs in import/url declarations to correctly point to
  * the desired files, and prepend a comment with debugging information about
  * this process.
  * 
  * @return string 
  */
 public static function minify($content, $options = array())
 {
     $id = isset($options['id']) && $options['id'] ? $options['id'] : '';
     $content = str_replace("\r\n", "\n", $content);
     $lines = explode("\n", $content);
     $numLines = count($lines);
     // determine left padding
     $padTo = strlen($numLines);
     $inComment = false;
     $i = 0;
     $newLines = array();
     while (null !== ($line = array_shift($lines))) {
         if ('' !== $id && 0 == $i % 50) {
             array_push($newLines, '', "/* {$id} */", '');
         }
         ++$i;
         $newLines[] = self::_addNote($line, $i, $inComment, $padTo);
         $inComment = self::_eolInComment($line, $inComment);
     }
     $content = implode("\n", $newLines) . "\n";
     // check for desired URI rewriting
     if (isset($options['currentDir'])) {
         require_once W3TC_LIB_MINIFY_DIR . '/Minify/CSS/UriRewriter.php';
         Minify_CSS_UriRewriter::$debugText = '';
         $content = Minify_CSS_UriRewriter::rewrite($content, $options['currentDir'], isset($options['docRoot']) ? $options['docRoot'] : $_SERVER['DOCUMENT_ROOT'], isset($options['symlinks']) ? $options['symlinks'] : array(), isset($options['browserCacheId']) ? $options['browserCacheId'] : 0, isset($options['browserCacheExtensions']) ? $options['browserCacheExtensions'] : array());
         $content = "/* Minify_CSS_UriRewriter::\$debugText\n\n" . Minify_CSS_UriRewriter::$debugText . "*/\n" . $content;
     } elseif (isset($options['prependRelativePath'])) {
         require_once W3TC_LIB_MINIFY_DIR . '/Minify/CSS/UriRewriter.php';
         Minify_CSS_UriRewriter::$debugText = '';
         $content = Minify_CSS_UriRewriter::prepend($content, $options['prependRelativePath'], isset($options['browserCacheId']) ? $options['browserCacheId'] : 0, isset($options['browserCacheExtensions']) ? $options['browserCacheExtensions'] : array());
     }
     return $content;
 }
开发者ID:niko-lgdcom,项目名称:archives,代码行数:54,代码来源:Lines.php

示例5: minify

 public static function minify($css, $options = array())
 {
     $options = array_merge(array('remove_bslash' => true, 'compress_colors' => true, 'compress_font-weight' => true, 'lowercase_s' => false, 'optimise_shorthands' => 1, 'remove_last_;' => false, 'case_properties' => 1, 'sort_properties' => false, 'sort_selectors' => false, 'merge_selectors' => 2, 'discard_invalid_properties' => false, 'css_level' => 'CSS2.1', 'preserve_css' => false, 'timestamp' => false, 'template' => 'default'), $options);
     set_include_path(get_include_path() . PATH_SEPARATOR . W3TC_LIB_CSSTIDY_DIR);
     require_once 'class.csstidy.php';
     $csstidy = new csstidy();
     foreach ($options as $option => $value) {
         $csstidy->set_cfg($option, $value);
     }
     $csstidy->load_template($options['template']);
     $csstidy->parse($css);
     $css = $csstidy->print->plain();
     if (isset($options['currentDir']) || isset($options['prependRelativePath'])) {
         require_once W3TC_LIB_MINIFY_DIR . '/Minify/CSS/UriRewriter.php';
         $browsercache_id = isset($options['browserCacheId']) ? $options['browserCacheId'] : 0;
         $browsercache_extensions = isset($options['browserCacheExtensions']) ? $options['browserCacheExtensions'] : array();
         if (isset($options['currentDir'])) {
             $document_root = isset($options['docRoot']) ? $options['docRoot'] : $_SERVER['DOCUMENT_ROOT'];
             $symlinks = isset($options['symlinks']) ? $options['symlinks'] : array();
             return Minify_CSS_UriRewriter::rewrite($css, $options['currentDir'], $document_root, $symlinks, $browsercache_id, $browsercache_extensions);
         } else {
             return Minify_CSS_UriRewriter::prepend($css, $options['prependRelativePath'], $browsercache_id, $browsercache_extensions);
         }
     }
     return $css;
 }
开发者ID:niko-lgdcom,项目名称:archives,代码行数:26,代码来源:CSSTidy.php

示例6: minify

 /**
  * Minifies content
  * @param string $content
  * @param array $options
  * @return string
  */
 public static function minify($content, $options = array())
 {
     if (isset($options['currentDir'])) {
         require_once W3TC_LIB_MINIFY_DIR . '/Minify/CSS/UriRewriter.php';
         $content = Minify_CSS_UriRewriter::rewrite($content, $options['currentDir'], isset($options['docRoot']) ? $options['docRoot'] : $_SERVER['DOCUMENT_ROOT'], isset($options['symlinks']) ? $options['symlinks'] : array());
     } elseif (isset($options['prependRelativePath'])) {
         require_once W3TC_LIB_MINIFY_DIR . '/Minify/CSS/UriRewriter.php';
         $content = Minify_CSS_UriRewriter::prepend($content, $options['prependRelativePath']);
     }
     return $content;
 }
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:17,代码来源:CombineOnly.php

示例7: minify

 /**
  * Minifies content
  * @param string $content
  * @param array $options
  * @return string
  */
 public static function minify($content, $options = array())
 {
     $browsercache_id = isset($options['browserCacheId']) ? $options['browserCacheId'] : 0;
     $browsercache_extensions = isset($options['browserCacheExtensions']) ? $options['browserCacheExtensions'] : array();
     if (isset($options['currentDir'])) {
         require_once W3TC_LIB_MINIFY_DIR . '/Minify/CSS/UriRewriter.php';
         $document_root = isset($options['docRoot']) ? $options['docRoot'] : $_SERVER['DOCUMENT_ROOT'];
         $symlinks = isset($options['symlinks']) ? $options['symlinks'] : array();
         $content = Minify_CSS_UriRewriter::rewrite($content, $options['currentDir'], $document_root, $symlinks, $browsercache_id, $browsercache_extensions);
     } elseif (isset($options['prependRelativePath'])) {
         require_once W3TC_LIB_MINIFY_DIR . '/Minify/CSS/UriRewriter.php';
         $content = Minify_CSS_UriRewriter::prepend($content, $options['prependRelativePath'], $browsercache_id, $browsercache_extensions);
     }
     return $content;
 }
开发者ID:niko-lgdcom,项目名称:archives,代码行数:21,代码来源:CombineOnly.php

示例8: minify

 /**
  * Minify a CSS string
  * 
  * @param string $css
  * 
  * @param array $options available options:
  * 
  * 'removeCharsets': (default true) remove all @charset at-rules
  *
  * 'prependRelativePath': (default null) if given, this string will be
  * prepended to all relative URIs in import/url declarations
  * 
  * 'currentDir': (default null) if given, this is assumed to be the
  * directory of the current CSS file. Using this, minify will rewrite
  * all relative URIs in import/url declarations to correctly point to
  * the desired files. For this to work, the files *must* exist and be
  * visible by the PHP process.
  *
  * 'symlinks': (default = array()) If the CSS file is stored in 
  * a symlink-ed directory, provide an array of link paths to
  * target paths, where the link paths are within the document root. Because 
  * paths need to be normalized for this to work, use "//" to substitute 
  * the doc root in the link paths (the array keys). E.g.:
  * <code>
  * array('//symlink' => '/real/target/path') // unix
  * array('//static' => 'D:\\staticStorage')  // Windows
  * </code>
  *
  * 'docRoot': (default = $_SERVER['DOCUMENT_ROOT'])
  * see Minify_CSS_UriRewriter::rewrite
  * 
  * @return string
  */
 public static function minify($css, $options = array())
 {
     $options = array_merge(array('compress' => true, 'removeCharsets' => true, 'currentDir' => null, 'docRoot' => $_SERVER['DOCUMENT_ROOT'], 'prependRelativePath' => null, 'symlinks' => array()), $options);
     if ($options['removeCharsets']) {
         $css = preg_replace('/@charset[^;]+;\\s*/', '', $css);
     }
     if ($options['compress']) {
         $obj = new CSSmin();
         $css = $obj->run($css);
     }
     if (!$options['currentDir'] && !$options['prependRelativePath']) {
         return $css;
     }
     if ($options['currentDir']) {
         return Minify_CSS_UriRewriter::rewrite($css, $options['currentDir'], $options['docRoot'], $options['symlinks']);
     } else {
         return Minify_CSS_UriRewriter::prepend($css, $options['prependRelativePath']);
     }
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:52,代码来源:CSSmin.php

示例9: _minify

 /** 
  * Internal function for (maybe) minifying assets
  * 
  * @param	Type of asset to minify (css/js)
  * @param	Contents to be minified
  * @param	The name of the file being minified (used for logging)
  * @param	mixed A relative path to use, if provided (for css minification)
  * @return	String (maybe) minified contents of file
  */
 protected function _minify($type, $contents, $filename, $rel = FALSE)
 {
     // used in case we need to return orig
     $contents_orig = $contents;
     switch ($type) {
         case 'js':
             /**
              * JS pre-minify hook
              */
             if ($this->EE->extensions->active_hook('minimee_pre_minify_js')) {
                 Minimee_helper::log('Hook `minimee_pre_minify_js` has been activated.', 3);
                 // pass contents to be minified, and instance of self
                 $contents = $this->EE->extensions->call('minimee_pre_minify_js', $contents, $filename, $this);
                 if ($this->EE->extensions->end_script === TRUE) {
                     return $contents;
                 }
                 // re-set $contents_orig in case we need to return
                 $contents_orig = $contents;
             }
             // HOOK END
             // be sure we want to minify
             if ($this->config->is_yes('minify_js')) {
                 // See if JSMinPlus was explicitly requested
                 if ($this->config->js_library == 'jsminplus') {
                     Minimee_helper::log('Running minification with JSMinPlus.', 3);
                     Minimee_helper::library('jsminplus');
                     $contents = JSMinPlus::minify($contents);
                 } else {
                     if ($this->config->js_library == 'jsmin') {
                         Minimee_helper::log('Running minification with JSMin.', 3);
                         Minimee_helper::library('jsmin');
                         $contents = JSMin::minify($contents);
                     }
                 }
             }
             break;
         case 'css':
             /**
              * CSS pre-minify hook
              */
             if ($this->EE->extensions->active_hook('minimee_pre_minify_css')) {
                 Minimee_helper::log('Hook `minimee_pre_minify_css` has been activated.', 3);
                 // pass contents to be minified, relative path, and instance of self
                 $contents = $this->EE->extensions->call('minimee_pre_minify_css', $contents, $filename, $rel, $this);
                 if ($this->EE->extensions->end_script === TRUE) {
                     return $contents;
                 }
                 // copy to $contents_orig in case we need to return
                 $contents_orig = $contents;
             }
             // HOOK END
             // prepend URL if relative path exists & configured to do so
             if ($rel !== FALSE && $this->config->is_yes('css_prepend_mode')) {
                 Minimee_helper::library('css_urirewriter');
                 $contents = Minify_CSS_UriRewriter::prepend($contents, $rel . '/');
                 // copy to $contents_orig in case we need to return
                 $contents_orig = $contents;
             }
             // minify if configured to do so
             if ($this->config->is_yes('minify_css')) {
                 // See if CSSMin was explicitly requested
                 if ($this->config->css_library == 'cssmin') {
                     Minimee_helper::log('Running minification with CSSMin.', 3);
                     Minimee_helper::library('cssmin');
                     $cssmin = new CSSmin(FALSE);
                     $contents = $cssmin->run($contents);
                     unset($cssmin);
                 } else {
                     if ($this->config->css_library == 'minify') {
                         Minimee_helper::log('Running minification with Minify_CSS.', 3);
                         Minimee_helper::library('minify');
                         $contents = Minify_CSS::minify($contents);
                     }
                 }
             }
             break;
     }
     // calculate weight loss
     $before = strlen($contents_orig);
     $after = strlen($contents);
     $diff = $before - $after;
     // quick check that contents are not empty
     if ($after == 0) {
         Minimee_helper::log('Minification has returned an empty string for `' . $filename . '`.', 2);
     }
     // did we actually reduce our file size? It's possible an already minified asset
     // uses a more aggressive algorithm than Minify; in that case, keep original contents
     if ($diff > 0) {
         $diff_formatted = $diff < 100 ? $diff . 'b' : round($diff / 1000, 2) . 'kb';
         $change = round($diff / $before * 100, 2);
         Minimee_helper::log('Minification has reduced ' . $filename . ' by ' . $diff_formatted . ' (' . $change . '%).', 3);
//.........这里部分代码省略.........
开发者ID:nitind12,项目名称:uc_,代码行数:101,代码来源:Minimee_lib.php

示例10: CssEncoder

function CssEncoder($css, $options = array())
{
    require_once 'Minify/CSS/UriRewriter.php';
    if (isset($options['currentDir'])) {
        return Minify_CSS_UriRewriter::rewrite($css, $options['currentDir'], isset($options['docRoot']) ? $options['docRoot'] : $_SERVER['DOCUMENT_ROOT'], isset($options['symlinks']) ? $options['symlinks'] : array());
    } else {
        return Minify_CSS_UriRewriter::prepend($css, $options['prependRelativePath']);
    }
}
开发者ID:laiello,项目名称:lussumo-vanilla,代码行数:9,代码来源:config.php

示例11: minifyAsset

 /**
  * Given an asset, fetches and returns minified contents.
  *
  * @param Minimee_BaseAssetModel $asset
  * @return String
  */
 protected function minifyAsset($asset)
 {
     craft()->config->maxPowerCaptain();
     switch ($this->type) {
         case MinimeeType::Js:
             if ($this->settings->minifyJsEnabled) {
                 $contents = \JSMin::minify($asset->contents);
             } else {
                 $contents = $asset->contents;
             }
             // Play nice with others by ensuring a semicolon at eof
             if (substr($contents, -1) != ';') {
                 $contents .= ';';
             }
             break;
         case MinimeeType::Css:
             $cssPrependUrl = dirname($asset->filenameUrl) . '/';
             $contents = \Minify_CSS_UriRewriter::prepend($asset->contents, $cssPrependUrl);
             if ($this->settings->minifyCssEnabled) {
                 $contents = \Minify_CSS::minify($contents);
             }
             break;
     }
     return $contents;
 }
开发者ID:speder,项目名称:craft.minimee,代码行数:31,代码来源:MinimeeService.php

示例12: rewriteUris

 /**
  * Rewrite the urls in a CSS file
  *
  * @param   string  $file     The path to the file
  * @param   string  $content  The file contents
  * @return  string
  */
 public static function rewriteUris($file, $content)
 {
     $path = dirname($file) . '/';
     return Minify_CSS_UriRewriter::prepend($content, $path);
 }
开发者ID:korenskoy,项目名称:sfCombinePlugin,代码行数:12,代码来源:sfCombineCombinerCss.class.php

示例13: minifyCssAsset

 /**
  * Method to (maybe) minify CSS asset
  *
  * @param Minimee_BaseAssetModel $asset
  * @return String
  */
 protected function minifyCssAsset($asset)
 {
     $contents = $asset->contents;
     if ($this->settings->minifyCssEnabled) {
         $compressor = new \CSSmin();
         $contents = $compressor->run($contents);
     }
     if ($this->settings->cssPrependUrlEnabled) {
         $cssPrependUrl = $this->settings->cssPrependUrl;
         if (!$cssPrependUrl) {
             $cssPrependUrl = dirname($asset->filenameUrl) . '/';
         }
         $contents = \Minify_CSS_UriRewriter::prepend($contents, $cssPrependUrl);
     }
     return $contents;
 }
开发者ID:johndwells,项目名称:craft.minimee,代码行数:22,代码来源:MinimeeService.php

示例14: elgg_prepend_css_urls

/**
 * In CSS content, prepend a path to relative URLs.
 *
 * This is useful to process a CSS view being used as an extension.
 *
 * @param string $css  CSS
 * @param string $path Path to prepend. E.g. "foo/bar/" or "../"
 *
 * @return string
 * @since 2.2
 */
function elgg_prepend_css_urls($css, $path)
{
    return Minify_CSS_UriRewriter::prepend($css, $path);
}
开发者ID:elgg,项目名称:elgg,代码行数:15,代码来源:views.php


注:本文中的Minify_CSS_UriRewriter::prepend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。