Sha256: 968c384c2f7631ec232db5cbf8afcb1c76338c61cb3c9da31763479ca5e6854b

Contents?: true

Size: 818 Bytes

Versions: 10

Compression:

Stored size: 818 Bytes

Contents

module Sass
  module Script
    module Functions
      def image_path(source, _options = {})
        if defined?(::Sprockets)
          ::Sass::Script::String.new sprockets_context.image_path(source.value).to_s, :string
        elsif defined?(::Compass)
          image_url(source, Sass::Script::Bool.new(true))
        else
          # Revert to the old compass-agnostic path determination
          asset_sans_quotes = source.value.gsub('"', '')
          Sass::Script::String.new("/images/#{asset_sans_quotes}", :string)
        end
      end

    protected

      def sprockets_context # :nodoc:
        if options.key?(:sprockets)
          options[:sprockets][:context]
        else
          # Compatibility with sprockets pre 2.10.0
          options[:importer].context
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
rails_admin-1.0.0.rc lib/rails_admin/bootstrap-sass/compass_functions.rb
rails_admin-0.8.1 lib/rails_admin/bootstrap-sass/compass_functions.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/rails_admin-0.7.0/lib/rails_admin/bootstrap-sass/compass_functions.rb
rails_admin-0.7.0 lib/rails_admin/bootstrap-sass/compass_functions.rb
rails_admin-0.6.8 lib/rails_admin/bootstrap-sass/compass_functions.rb
rails_admin-0.6.7 lib/rails_admin/bootstrap-sass/compass_functions.rb
rails_admin-0.6.6 lib/rails_admin/bootstrap-sass/compass_functions.rb
rails_admin-0.6.5 lib/rails_admin/bootstrap-sass/compass_functions.rb
rails_admin-0.6.4 lib/rails_admin/bootstrap-sass/compass_functions.rb
rails_admin-0.6.3 lib/rails_admin/bootstrap-sass/compass_functions.rb