Skip to content

Commit 575c73d

Browse files
author
Francesco Rodriguez
committed
dont override private sass api
1 parent e563be8 commit 575c73d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lib/sass/rails/importer.rb

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,21 @@ def extensions
1919
}.merge!(super)
2020
end
2121

22-
def find_relative_with_glob(name, base, options)
22+
def find_relative(name, base, options)
2323
if name =~ GLOB
2424
glob_imports(name, Pathname.new(base), options)
2525
else
26-
find_relative_without_glob(name, base, options)
26+
engine_from_path(name, File.dirname(base), options)
2727
end
2828
end
29-
alias_method :find_relative_without_glob, :find_relative
30-
alias_method :find_relative, :find_relative_with_glob
3129

32-
def find_with_glob(name, options)
30+
def find(name, options)
3331
if name =~ GLOB
3432
nil # globs must be relative
3533
else
36-
find_without_glob(name, options)
34+
engine_from_path(name, root, options)
3735
end
3836
end
39-
alias_method :find_without_glob, :find
40-
alias_method :find, :find_with_glob
4137

4238
def each_globbed_file(glob, base_pathname, options)
4339
Dir["#{base_pathname}/#{glob}"].sort.each do |filename|
@@ -66,15 +62,21 @@ def glob_imports(glob, base_pathname, options)
6662

6763
private
6864

69-
def _find(dir, name, options)
65+
def engine_from_path(name, dir, options)
7066
full_filename, syntax = Sass::Util.destructure(find_real_file(dir, name, options))
7167
return unless full_filename && File.readable?(full_filename)
7268

73-
Sass::Engine.new(evaluate(full_filename), options.merge(
69+
engine = Sass::Engine.new(evaluate(full_filename), options.merge(
7470
syntax: syntax,
7571
filename: full_filename,
7672
importer: self
7773
))
74+
75+
if engine && (filename = engine.options[:filename])
76+
@context.depend_on(filename)
77+
end
78+
79+
engine
7880
end
7981

8082
def evaluate(filename)

0 commit comments

Comments
 (0)