@@ -19,25 +19,21 @@ def extensions
19
19
} . merge! ( super )
20
20
end
21
21
22
- def find_relative_with_glob ( name , base , options )
22
+ def find_relative ( name , base , options )
23
23
if name =~ GLOB
24
24
glob_imports ( name , Pathname . new ( base ) , options )
25
25
else
26
- find_relative_without_glob ( name , base , options )
26
+ engine_from_path ( name , File . dirname ( base ) , options )
27
27
end
28
28
end
29
- alias_method :find_relative_without_glob , :find_relative
30
- alias_method :find_relative , :find_relative_with_glob
31
29
32
- def find_with_glob ( name , options )
30
+ def find ( name , options )
33
31
if name =~ GLOB
34
32
nil # globs must be relative
35
33
else
36
- find_without_glob ( name , options )
34
+ engine_from_path ( name , root , options )
37
35
end
38
36
end
39
- alias_method :find_without_glob , :find
40
- alias_method :find , :find_with_glob
41
37
42
38
def each_globbed_file ( glob , base_pathname , options )
43
39
Dir [ "#{ base_pathname } /#{ glob } " ] . sort . each do |filename |
@@ -66,15 +62,21 @@ def glob_imports(glob, base_pathname, options)
66
62
67
63
private
68
64
69
- def _find ( dir , name , options )
65
+ def engine_from_path ( name , dir , options )
70
66
full_filename , syntax = Sass ::Util . destructure ( find_real_file ( dir , name , options ) )
71
67
return unless full_filename && File . readable? ( full_filename )
72
68
73
- Sass ::Engine . new ( evaluate ( full_filename ) , options . merge (
69
+ engine = Sass ::Engine . new ( evaluate ( full_filename ) , options . merge (
74
70
syntax : syntax ,
75
71
filename : full_filename ,
76
72
importer : self
77
73
) )
74
+
75
+ if engine && ( filename = engine . options [ :filename ] )
76
+ @context . depend_on ( filename )
77
+ end
78
+
79
+ engine
78
80
end
79
81
80
82
def evaluate ( filename )
0 commit comments