Class: Sprockets::SassImporter

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

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initialize(context, root) ⇒ SassImporter

Returns a new instance of SassImporter.



13
14
15
16
# File 'lib/classy_assets/sprockets/sass_importer.rb', line 13

def initialize(context, root)
  @context = context
  super root.to_s
end

Instance Method Details

#extensionsObject



18
19
20
21
22
23
24
25
# File 'lib/classy_assets/sprockets/sass_importer.rb', line 18

def extensions
  {
    'css'          => :scss,
    'css.erb'      => :scss,
    'scss.erb'     => :scss,
    'sass.erb'     => :sass
  }.merge!(super)
end

#find(name, options = {}) ⇒ Object



27
28
29
30
# File 'lib/classy_assets/sprockets/sass_importer.rb', line 27

def find(name, options = {})
  return nil if name =~ GLOB # globs must be relative
  engine_from_path(name, root, options)
end

#find_relative(name, base, options) ⇒ Object



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

def find_relative(name, base, options)
  if name =~ GLOB
    glob_imports(name, Pathname.new(base), options)
  else
    engine_from_path(name, File.dirname(base), options)
  end
end