Class: CompassRails4::SpriteImporter

Inherits:
Compass::SpriteImporter
  • Object
show all
Defined in:
lib/compass-rails4/patches/sprite_importer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, root) ⇒ SpriteImporter

Returns a new instance of SpriteImporter.



5
6
7
8
# File 'lib/compass-rails4/patches/sprite_importer.rb', line 5

def initialize(context, root)
  @context = context
  @root = root
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



3
4
5
# File 'lib/compass-rails4/patches/sprite_importer.rb', line 3

def context
  @context
end

#rootObject (readonly)

Returns the value of attribute root.



3
4
5
# File 'lib/compass-rails4/patches/sprite_importer.rb', line 3

def root
  @root
end

Instance Method Details

#find(uri, options) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/compass-rails4/patches/sprite_importer.rb', line 10

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

      end
    end
  end

  old
end