Class: Sprockets::SassImporter

Inherits:
Sass::Importers::Filesystem
  • Object
show all
Defined in:
lib/sprockets/sass_importer.rb

Overview

This custom importer that tracks all imported filenames during compile.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ SassImporter

Returns a new instance of SassImporter.



9
10
11
12
# File 'lib/sprockets/sass_importer.rb', line 9

def initialize(*args)
  @imported_filenames = []
  super
end

Instance Attribute Details

#imported_filenamesObject (readonly)

Returns the value of attribute imported_filenames.



7
8
9
# File 'lib/sprockets/sass_importer.rb', line 7

def imported_filenames
  @imported_filenames
end

Instance Method Details

#find(*args) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/sprockets/sass_importer.rb', line 22

def find(*args)
  engine = super
  if engine && (filename = engine.options[:filename])
    @imported_filenames << filename
  end
  engine
end

#find_relative(*args) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/sprockets/sass_importer.rb', line 14

def find_relative(*args)
  engine = super
  if engine && (filename = engine.options[:filename])
    @imported_filenames << filename
  end
  engine
end