From 8aee42e5a1406c11fa327d3aa4275b00ff19643b Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Wed, 29 Apr 2009 08:26:27 -0700 Subject: [PATCH] [Compass Core] The image_url sass function now handles absolute urls correctly. --- lib/sass_extensions.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/sass_extensions.rb b/lib/sass_extensions.rb index 4a025185..0d76425c 100644 --- a/lib/sass_extensions.rb +++ b/lib/sass_extensions.rb @@ -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.