[CSS3] if a root relative url is passed to image-url, still find the file and do the normal processing.
This commit is contained in:
parent
e6c418062b
commit
06ab3d4b41
@ -36,8 +36,12 @@ module Compass::SassExtensions::Functions::Urls
|
||||
def image_url(path)
|
||||
path = path.value # get to the string value of the literal.
|
||||
|
||||
if path =~ %r{^#{Regexp.escape(Compass.configuration.http_images_path)}/(.*)}
|
||||
# Treat root relative urls (without a protocol) like normal if they start with
|
||||
# the images path.
|
||||
path = $1
|
||||
elsif absolute_path?(path)
|
||||
# Short curcuit if they have provided an absolute url.
|
||||
if absolute_path?(path)
|
||||
return Sass::Script::String.new("url(#{path})")
|
||||
end
|
||||
|
||||
|
23
test/fixtures/stylesheets/compass/css/border_radius.css
vendored
Normal file
23
test/fixtures/stylesheets/compass/css/border_radius.css
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
.simple {
|
||||
-webkit-border-radius: 4px 4px;
|
||||
-moz-border-radius: 4px / 4px;
|
||||
-o-border-radius: 4px / 4px;
|
||||
-ms-border-radius: 4px / 4px;
|
||||
-khtml-border-radius: 4px / 4px;
|
||||
border-radius: 4px / 4px; }
|
||||
|
||||
.compound {
|
||||
-webkit-border-radius: 2px 3px;
|
||||
-moz-border-radius: 2px 5px / 3px 6px;
|
||||
-o-border-radius: 2px 5px / 3px 6px;
|
||||
-ms-border-radius: 2px 5px / 3px 6px;
|
||||
-khtml-border-radius: 2px 5px / 3px 6px;
|
||||
border-radius: 2px 5px / 3px 6px; }
|
||||
|
||||
.crazy {
|
||||
-webkit-border-radius: 1px 2px;
|
||||
-moz-border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px;
|
||||
-o-border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px;
|
||||
-ms-border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px;
|
||||
-khtml-border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px;
|
||||
border-radius: 1px 3px 5px 7px / 2px 4px 6px 8px; }
|
8
test/fixtures/stylesheets/compass/css/images.css
vendored
Normal file
8
test/fixtures/stylesheets/compass/css/images.css
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
.relative {
|
||||
background-image: url('/images/4x6.png?busted=true'); }
|
||||
|
||||
.root-relative {
|
||||
background-image: url('/images/4x6.png?busted=true'); }
|
||||
|
||||
.absolute {
|
||||
background-image: url(http://example.com/images/4x6.png); }
|
5
test/fixtures/stylesheets/compass/sass/border_radius.scss
vendored
Normal file
5
test/fixtures/stylesheets/compass/sass/border_radius.scss
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
@import "compass/css3/border-radius";
|
||||
|
||||
.simple { @include border-radius(4px, 4px); }
|
||||
.compound { @include border-radius(2px 5px, 3px 6px); }
|
||||
.crazy { @include border-radius(1px 3px 5px 7px, 2px 4px 6px 8px)}
|
9
test/fixtures/stylesheets/compass/sass/images.scss
vendored
Normal file
9
test/fixtures/stylesheets/compass/sass/images.scss
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
.relative {
|
||||
background-image: image-url("4x6.png");
|
||||
}
|
||||
.root-relative {
|
||||
background-image: image-url("/images/4x6.png");
|
||||
}
|
||||
.absolute {
|
||||
background-image: image-url("http://example.com/images/4x6.png");
|
||||
}
|
Loading…
Reference in New Issue
Block a user