[Compass Core] The image_url sass function now handles absolute urls correctly.

This commit is contained in:
Chris Eppstein 2009-04-29 08:26:27 -07:00
parent 6409be1646
commit 8aee42e5a1

View File

@ -19,6 +19,9 @@ module Sass::Script::Functions
end
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
if (target_css_file = options[:css_filename])
images_path = File.join(Compass.configuration.project_path, Compass.configuration.images_dir)
@ -35,6 +38,11 @@ module Sass::Script::Functions
end
Sass::Script::String.new("url(#{path})")
end
private
def absolute_path?(path)
path[0..0] == "/" || path[0..3] == "http"
end
end
# XXX: We can remove this check and monkeypatch once Sass 2.2 is released.