Module: Compass::SassExtensions::Functions::Urls::ImageUrl

Defined in:
lib/compass-rails/railties/2_3.rb

Instance Method Summary collapse

Instance Method Details

#image_url_with_rails_integration(path, only_path = Sass::Script::Bool.new(false), cache_buster = Sass::Script::Bool.new(true)) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/compass-rails/railties/2_3.rb', line 26

def image_url_with_rails_integration(path, only_path = Sass::Script::Bool.new(false), cache_buster = Sass::Script::Bool.new(true))
  if (@controller = Sass::Plugin.rails_controller) && @controller.respond_to?(:request) && @controller.request
    begin
      if only_path.to_bool
        Sass::Script::String.new image_path(path.value)
      else
        Sass::Script::String.new "url(#{image_path(path.value)})"
      end
    ensure
      @controller = nil
    end
  else
    image_url_without_rails_integration(path, only_path, cache_buster)
  end
end