mirror of
https://github.com/mrclay/minify.git
synced 2025-08-15 10:34:02 +02:00
Merge branch '2.x' into merge2x
Conflicts: .gitignore HISTORY.txt README.md config.php docs/CookBook.wiki.md docs/CustomSource.wiki.md lib/Minify/CSS/UriRewriter.php min/lib/DooDigestAuth.php min/lib/FirePHP.php min/lib/JSMinPlus.php min/lib/Minify/Controller/Base.php min/lib/Minify/Loader.php min/lib/Minify/Logger.php
This commit is contained in:
@@ -67,12 +67,16 @@ class Minify_CSS_UriRewriter {
|
||||
|
||||
$css = self::_trimUrls($css);
|
||||
|
||||
$css = self::_owlifySvgPaths($css);
|
||||
|
||||
// rewrite
|
||||
$css = preg_replace_callback('/@import\\s+([\'"])(.*?)[\'"]/'
|
||||
,array(self::$className, '_processUriCB'), $css);
|
||||
$css = preg_replace_callback('/url\\(\\s*([\'"](.*?)[\'"]|[^\\)\\s]+)\\s*\\)/'
|
||||
,array(self::$className, '_processUriCB'), $css);
|
||||
|
||||
$css = self::_unOwlify($css);
|
||||
|
||||
return $css;
|
||||
}
|
||||
|
||||
@@ -91,12 +95,16 @@ class Minify_CSS_UriRewriter {
|
||||
|
||||
$css = self::_trimUrls($css);
|
||||
|
||||
$css = self::_owlifySvgPaths($css);
|
||||
|
||||
// append
|
||||
$css = preg_replace_callback('/@import\\s+([\'"])(.*?)[\'"]/'
|
||||
,array(self::$className, '_processUriCB'), $css);
|
||||
$css = preg_replace_callback('/url\\(\\s*([\'"](.*?)[\'"]|[^\\)\\s]+)\\s*\\)/'
|
||||
,array(self::$className, '_processUriCB'), $css);
|
||||
|
||||
$css = self::_unOwlify($css);
|
||||
|
||||
self::$_prependPath = null;
|
||||
|
||||
return $css;
|
||||
@@ -308,4 +316,29 @@ class Minify_CSS_UriRewriter {
|
||||
? "@import {$quoteChar}{$uri}{$quoteChar}"
|
||||
: "url({$quoteChar}{$uri}{$quoteChar})";
|
||||
}
|
||||
|
||||
/**
|
||||
* Mungs some inline SVG URL declarations so they won't be touched
|
||||
*
|
||||
* @link https://github.com/mrclay/minify/issues/517
|
||||
* @see _unOwlify
|
||||
*
|
||||
* @param string $css
|
||||
* @return string
|
||||
*/
|
||||
private static function _owlifySvgPaths($css) {
|
||||
return preg_replace('~\b((?:clip-path|mask|-webkit-mask)\s*\:\s*)url(\(\s*#\w+\s*\))~', '$1owl$2', $css);
|
||||
}
|
||||
|
||||
/**
|
||||
* Undo work of _owlify
|
||||
*
|
||||
* @see _owlifySvgPaths
|
||||
*
|
||||
* @param string $css
|
||||
* @return string
|
||||
*/
|
||||
private static function _unOwlify($css) {
|
||||
return preg_replace('~\b((?:clip-path|mask|-webkit-mask)\s*\:\s*)owl~', '$1url', $css);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user