Module: Compass::ImportOnce::Importer

Defined in:
lib/compass/import-once/importer.rb

Overview

Any importer object that is extended with this module will get the import once behavior.

Instance Method Summary collapse

Instance Method Details

#find(uri, options, *args) ⇒ Object



10
11
12
13
# File 'lib/compass/import-once/importer.rb', line 10

def find(uri, options, *args)
  uri, force_import = handle_force_import(uri)
  maybe_replace_with_dummy_engine(super(uri, options, *args), options, force_import)
end

#find_relative(uri, base, options, *args) ⇒ Object



5
6
7
8
# File 'lib/compass/import-once/importer.rb', line 5

def find_relative(uri, base, options, *args)
  uri, force_import = handle_force_import(uri)
  maybe_replace_with_dummy_engine(super(uri, base, options, *args), options, force_import)
end

#key(uri, options, *args) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/compass/import-once/importer.rb', line 15

def key(uri, options, *args)
  if uri =~ /^\(NOT IMPORTED\) (.*)$/
    ["(import-once)", $1]
  else
    super
  end
end

#mtime(uri, options, *args) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/compass/import-once/importer.rb', line 23

def mtime(uri, options, *args)
  if uri =~ /^\(NOT IMPORTED\) (.*)$/
    File.mtime($1) if File.exist?($1)
  else
    super
  end
end