def generated_image_url(path, cache_buster = Sass::Script::Bool.new(false))
path = path.value
if path =~ %r{^#{Regexp.escape(Compass.configuration.http_generated_images_path)}/(.*)}
path = $1
elsif absolute_path?(path)
return Sass::Script::String.new("url(#{path})")
end
http_generated_images_path = if relative?
compute_relative_path(Compass.configuration.generated_images_path)
elsif Compass.configuration.http_generated_images_path
Compass.configuration.http_generated_images_path
else
Compass.configuration.http_root_relative(Compass.configuration.generated_images_dir)
end
real_path = if Compass.configuration.generated_images_dir
File.join(Compass.configuration.project_path, Compass.configuration.generated_images_dir, path)
end
if http_generated_images_path
http_generated_images_path = "#{http_generated_images_path}/" unless http_generated_images_path[-1..-1] == "/"
path = "#{http_generated_images_path}#{path}"
end
asset_host = if !relative? && Compass.configuration.asset_host
Compass.configuration.asset_host.call(path)
end
if cache_buster.to_bool
if cache_buster.is_a?(Sass::Script::String)
path += "?#{cache_buster.value}"
else
path = cache_busted_path(path, real_path)
end
end
path = "#{asset_host}#{'/' unless path[0..0] == "/"}#{path}" if asset_host
clean_url(path)
end