Class: Sprockets::Sass::Importer

Inherits:
Sass::Importers::Base
  • Object
show all
Defined in:
lib/sprockets/sass/importer.rb

Constant Summary

GLOB =
/\*|\[.+\]/

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Importer) initialize(context)

Returns a new instance of Importer



13
14
15
# File 'lib/sprockets/sass/importer.rb', line 13

def initialize(context)
  @context = context
end

Instance Attribute Details

- (Object) context (readonly)

Reference to the Sprockets context



10
11
12
# File 'lib/sprockets/sass/importer.rb', line 10

def context
  @context
end

Instance Method Details

- (Object) find(path, options)

See Also:

  • Sass::Importers::Base#find


27
28
29
# File 'lib/sprockets/sass/importer.rb', line 27

def find(path, options)
  engine_from_path(path, options)
end

- (Object) find_relative(path, base_path, options)

See Also:

  • Sass::Importers::Base#find_relative


18
19
20
21
22
23
24
# File 'lib/sprockets/sass/importer.rb', line 18

def find_relative(path, base_path, options)
  if path =~ GLOB
    engine_from_glob(path, base_path, options)
  else
    engine_from_path(path, options)
  end
end

- (Object) key(path, options)

See Also:

  • Sass::Importers::Base#key


41
42
43
44
# File 'lib/sprockets/sass/importer.rb', line 41

def key(path, options)
  path = Pathname.new(path)
  ["#{self.class.name}:#{path.dirname.expand_path}", path.basename]
end

- (Object) mtime(path, options)

See Also:

  • Sass::Importers::Base#mtime


32
33
34
35
36
37
38
# File 'lib/sprockets/sass/importer.rb', line 32

def mtime(path, options)
  if pathname = resolve(path)
    pathname.mtime
  end
rescue Errno::ENOENT
  nil
end

- (Object) to_s

See Also:

  • Sass::Importers::Base#to_s


47
48
49
# File 'lib/sprockets/sass/importer.rb', line 47

def to_s
  "#{self.class.name}:#{context.pathname}"
end