Skip to content

Commit c29bcc2

Browse files
committed
pass context to erb render
1 parent e65638b commit c29bcc2

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/sassc/rails/importer.rb

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
module SassC
44
module Rails
55
class Importer < SassC::Importer
6-
76
class Extension
87
attr_reader :postfix
98

109
def initialize(postfix)
1110
@postfix = postfix
1211
end
1312

14-
def import_for(original_path, parent_path, full_path)
13+
def import_for(original_path, parent_path, full_path, options)
1514
SassC::Importer::Import.new(full_path)
1615
end
1716
end
@@ -21,7 +20,7 @@ def postfix
2120
".css"
2221
end
2322

24-
def import_for(original_path, parent_path, full_path)
23+
def import_for(original_path, parent_path, full_path, options)
2524
import_path = full_path.gsub(/\.css$/,"")
2625
SassC::Importer::Import.new(import_path)
2726
end
@@ -32,9 +31,9 @@ def initialize(postfix)
3231
super
3332
end
3433

35-
def import_for(original_path, parent_path, full_path)
34+
def import_for(original_path, parent_path, full_path, options)
3635
template = Tilt::ERBTemplate.new(full_path)
37-
parsed_erb = template.render
36+
parsed_erb = template.render(options[:sprockets][:context], {})
3837
SassC::Importer::Import.new(full_path, source: parsed_erb)
3938
end
4039
end
@@ -99,7 +98,7 @@ def imports(path, parent_path)
9998
try_path = File.join(search_path, file_name + extension.postfix)
10099
if File.exists?(try_path)
101100
record_import_as_dependency try_path
102-
return extension.import_for(path, parent_path, try_path)
101+
return extension.import_for(path, parent_path, try_path, options)
103102
end
104103
end
105104
end

0 commit comments

Comments
 (0)