Sha256: f0ba377188cbe1baf97cd714251101247c03d6c15e17e58e5068ace5ca54f832

Contents?: true

Size: 689 Bytes

Versions: 1

Compression:

Stored size: 689 Bytes

Contents

require 'sprockets'
require 'compass/sprite_importer'

module CompassRails
  class SpriteImporter < Compass::SpriteImporter
    attr_reader :root

    def initialize(root)
      @root = root
    end

    def find(uri, options)
      if old = super(uri, options)
        context = options[:sprockets][:context]
        files = self.class.files(uri)
        files.each do |file|
          relative_path = Pathname.new(file).relative_path_from(Pathname.new(root))
          begin
            pathname = context.resolve(relative_path.to_s)
            context.depend_on_asset(pathname)
          rescue Sprockets::FileNotFound

          end
        end
      end

      old
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
glebtv-compass-rails-2.0.4 lib/compass-rails/patches/sprite_importer.rb