mirror of
https://github.com/mrclay/minify.git
synced 2025-07-31 19:30:29 +02:00
@@ -290,6 +290,11 @@ class Minify_CSS_UriRewriter {
|
|||||||
? $m[1]
|
? $m[1]
|
||||||
: substr($m[1], 1, strlen($m[1]) - 2);
|
: substr($m[1], 1, strlen($m[1]) - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($uri === '') {
|
||||||
|
return $m[0];
|
||||||
|
}
|
||||||
|
|
||||||
// if not root/scheme relative and not starts with scheme
|
// if not root/scheme relative and not starts with scheme
|
||||||
if (!preg_match('~^(/|[a-z]+\:)~', $uri)) {
|
if (!preg_match('~^(/|[a-z]+\:)~', $uri)) {
|
||||||
// URI is file-relative: rewrite depending on options
|
// URI is file-relative: rewrite depending on options
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
@import url("/css/foo.css"); /* abs, should not alter */
|
@import url("/css/foo.css"); /* abs, should not alter */
|
||||||
@import url(/css2/foo.css); /* abs, should not alter */
|
@import url(/css2/foo.css); /* abs, should not alter */
|
||||||
@import url(foo:bar); /* scheme, should not alter */
|
@import url(foo:bar); /* scheme, should not alter */
|
||||||
|
@import url(); /* empty, should not alter */
|
||||||
foo {clip-path:url(#c1)} /* inline clip path, should not alter */
|
foo {clip-path:url(#c1)} /* inline clip path, should not alter */
|
||||||
foo {clip-path:url(/_test_files/css_uriRewriter/foo.svg#c1)}
|
foo {clip-path:url(/_test_files/css_uriRewriter/foo.svg#c1)}
|
||||||
foo {mask: url(#c1)} /* should not alter */
|
foo {mask: url(#c1)} /* should not alter */
|
||||||
@@ -17,5 +18,6 @@ foo {background:url('http://foo.com/css/foo.css');} /* scheme, should not alter
|
|||||||
foo {background:url("//foo.com/css/foo.css");} /* protocol relative, should not alter */
|
foo {background:url("//foo.com/css/foo.css");} /* protocol relative, should not alter */
|
||||||
foo {background:url(foo:bar);} /* scheme, should not alter */
|
foo {background:url(foo:bar);} /* scheme, should not alter */
|
||||||
foo {background:url("/_test_files/css_uriRewriter/foo bar.jpg");}
|
foo {background:url("/_test_files/css_uriRewriter/foo bar.jpg");}
|
||||||
|
foo {background:url("");} /* empty, should not alter */
|
||||||
@import url('/_test_files/css_uriRewriter/foo bar.css');
|
@import url('/_test_files/css_uriRewriter/foo bar.css');
|
||||||
@import "/_test_files/css_uriRewriter/foo bar.css";
|
@import "/_test_files/css_uriRewriter/foo bar.css";
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
@import url("/css/foo.css"); /* abs, should not alter */
|
@import url("/css/foo.css"); /* abs, should not alter */
|
||||||
@import url(/css2/foo.css); /* abs, should not alter */
|
@import url(/css2/foo.css); /* abs, should not alter */
|
||||||
@import url(foo:bar); /* scheme, should not alter */
|
@import url(foo:bar); /* scheme, should not alter */
|
||||||
|
@import url(); /* empty, should not alter */
|
||||||
foo {clip-path:url(#c1)} /* inline clip path, should not alter */
|
foo {clip-path:url(#c1)} /* inline clip path, should not alter */
|
||||||
foo {clip-path:url(http://cnd.com/A/B/foo.svg#c1)}
|
foo {clip-path:url(http://cnd.com/A/B/foo.svg#c1)}
|
||||||
foo {mask: url(#c1)} /* should not alter */
|
foo {mask: url(#c1)} /* should not alter */
|
||||||
@@ -17,5 +18,6 @@ foo {background:url('http://foo.com/css/foo.css');} /* scheme, should not alter
|
|||||||
foo {background:url("//foo.com/css/foo.css");} /* protocol relative, should not alter */
|
foo {background:url("//foo.com/css/foo.css");} /* protocol relative, should not alter */
|
||||||
foo {background:url(foo:bar);} /* scheme, should not alter */
|
foo {background:url(foo:bar);} /* scheme, should not alter */
|
||||||
foo {background:url("http://cnd.com/A/B/foo bar.jpg");}
|
foo {background:url("http://cnd.com/A/B/foo bar.jpg");}
|
||||||
|
foo {background:url("");} /* empty, should not alter */
|
||||||
@import url('http://cnd.com/A/B/foo bar.css');
|
@import url('http://cnd.com/A/B/foo bar.css');
|
||||||
@import "http://cnd.com/A/B/foo bar.css";
|
@import "http://cnd.com/A/B/foo bar.css";
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
@import url("/css/foo.css"); /* abs, should not alter */
|
@import url("/css/foo.css"); /* abs, should not alter */
|
||||||
@import url(/css2/foo.css); /* abs, should not alter */
|
@import url(/css2/foo.css); /* abs, should not alter */
|
||||||
@import url(foo:bar); /* scheme, should not alter */
|
@import url(foo:bar); /* scheme, should not alter */
|
||||||
|
@import url(); /* empty, should not alter */
|
||||||
foo {clip-path:url(#c1)} /* inline clip path, should not alter */
|
foo {clip-path:url(#c1)} /* inline clip path, should not alter */
|
||||||
foo {clip-path:url(//cnd.com/A/B/foo.svg#c1)}
|
foo {clip-path:url(//cnd.com/A/B/foo.svg#c1)}
|
||||||
foo {mask: url(#c1)} /* should not alter */
|
foo {mask: url(#c1)} /* should not alter */
|
||||||
@@ -17,5 +18,6 @@ foo {background:url('http://foo.com/css/foo.css');} /* scheme, should not alter
|
|||||||
foo {background:url("//foo.com/css/foo.css");} /* protocol relative, should not alter */
|
foo {background:url("//foo.com/css/foo.css");} /* protocol relative, should not alter */
|
||||||
foo {background:url(foo:bar);} /* scheme, should not alter */
|
foo {background:url(foo:bar);} /* scheme, should not alter */
|
||||||
foo {background:url("//cnd.com/A/B/foo bar.jpg");}
|
foo {background:url("//cnd.com/A/B/foo bar.jpg");}
|
||||||
|
foo {background:url("");} /* empty, should not alter */
|
||||||
@import url('//cnd.com/A/B/foo bar.css');
|
@import url('//cnd.com/A/B/foo bar.css');
|
||||||
@import "//cnd.com/A/B/foo bar.css";
|
@import "//cnd.com/A/B/foo bar.css";
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
@import url("/css/foo.css"); /* abs, should not alter */
|
@import url("/css/foo.css"); /* abs, should not alter */
|
||||||
@import url(/css2/foo.css); /* abs, should not alter */
|
@import url(/css2/foo.css); /* abs, should not alter */
|
||||||
@import url(foo:bar); /* scheme, should not alter */
|
@import url(foo:bar); /* scheme, should not alter */
|
||||||
|
@import url(); /* empty, should not alter */
|
||||||
foo {clip-path:url(#c1)} /* inline clip path, should not alter */
|
foo {clip-path:url(#c1)} /* inline clip path, should not alter */
|
||||||
foo {clip-path:url(foo.svg#c1)}
|
foo {clip-path:url(foo.svg#c1)}
|
||||||
foo {mask: url( #c1 )} /* should not alter */
|
foo {mask: url( #c1 )} /* should not alter */
|
||||||
@@ -17,5 +18,6 @@ foo {background:url('http://foo.com/css/foo.css');} /* scheme, should not alter
|
|||||||
foo {background:url("//foo.com/css/foo.css");} /* protocol relative, should not alter */
|
foo {background:url("//foo.com/css/foo.css");} /* protocol relative, should not alter */
|
||||||
foo {background:url(foo:bar);} /* scheme, should not alter */
|
foo {background:url(foo:bar);} /* scheme, should not alter */
|
||||||
foo {background:url("foo bar.jpg");}
|
foo {background:url("foo bar.jpg");}
|
||||||
|
foo {background:url("");} /* empty, should not alter */
|
||||||
@import url('foo bar.css');
|
@import url('foo bar.css');
|
||||||
@import "foo bar.css";
|
@import "foo bar.css";
|
||||||
|
Reference in New Issue
Block a user