[Compass Core] The image_url sass function now handles absolute urls correctly.
This commit is contained in:
parent
6409be1646
commit
8aee42e5a1
@ -19,6 +19,9 @@ module Sass::Script::Functions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def image_url(path)
|
def image_url(path)
|
||||||
|
if absolute_path?(path.value)
|
||||||
|
return Sass::Script::String.new("url(#{path})")
|
||||||
|
end
|
||||||
http_images_path = if Compass.configuration.http_images_path == :relative
|
http_images_path = if Compass.configuration.http_images_path == :relative
|
||||||
if (target_css_file = options[:css_filename])
|
if (target_css_file = options[:css_filename])
|
||||||
images_path = File.join(Compass.configuration.project_path, Compass.configuration.images_dir)
|
images_path = File.join(Compass.configuration.project_path, Compass.configuration.images_dir)
|
||||||
@ -35,6 +38,11 @@ module Sass::Script::Functions
|
|||||||
end
|
end
|
||||||
Sass::Script::String.new("url(#{path})")
|
Sass::Script::String.new("url(#{path})")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def absolute_path?(path)
|
||||||
|
path[0..0] == "/" || path[0..3] == "http"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# XXX: We can remove this check and monkeypatch once Sass 2.2 is released.
|
# XXX: We can remove this check and monkeypatch once Sass 2.2 is released.
|
||||||
|
Loading…
Reference in New Issue
Block a user