@@ -72,48 +72,25 @@ def erb_extensions
72
72
}
73
73
end
74
74
75
- def find_relative ( name , base , options )
76
- filename , syntax = find_filename ( File . dirname ( base ) , name , options )
77
-
78
- if syntax = erb_extensions [ syntax ]
79
- erb_engine ( filename , syntax , options )
80
- else
81
- super
82
- end
75
+ def find_relative ( *args )
76
+ process_erb_engine ( super )
83
77
end
84
78
85
- def find ( name , options )
86
- filename , syntax = find_filename ( root , name , options )
87
-
88
- if syntax = erb_extensions [ syntax ]
89
- erb_engine ( filename , syntax , options )
90
- else
91
- super
92
- end
79
+ def find ( *args )
80
+ process_erb_engine ( super )
93
81
end
94
82
95
83
private
96
- def find_filename ( dir , name , options )
97
- # Feature check additional options parameter that was added in 3.2.
98
- result = method ( :find_real_file ) . arity == 2 ?
99
- find_real_file ( dir , name ) :
100
- find_real_file ( dir , name , options )
101
-
102
- if result && File . readable? ( result [ 0 ] )
103
- return result
84
+ def process_erb_engine ( engine )
85
+ if engine && syntax = erb_extensions [ engine . options [ :syntax ] ]
86
+ template = Tilt :: ERBTemplate . new ( engine . options [ :filename ] )
87
+ contents = template . render ( context , { } )
88
+
89
+ Sass :: Engine . new ( contents , engine . options . merge ( :syntax => syntax ) )
90
+ else
91
+ engine
104
92
end
105
93
end
106
-
107
- def erb_engine ( filename , syntax , options )
108
- options [ :syntax ] = syntax
109
- options [ :filename ] = filename
110
- options [ :importer ] = self
111
-
112
- template = Tilt ::ERBTemplate . new ( filename ) { File . read ( filename ) }
113
- contents = template . render ( context , { } )
114
-
115
- Sass ::Engine . new ( contents , options )
116
- end
117
94
end
118
95
119
96
include ERB
0 commit comments