Skip to content

Commit

Permalink
Merge pull request #1558 from jkowens/fix-1172
Browse files Browse the repository at this point in the history
Lookup Tilt class for template engine without loading files
  • Loading branch information
jkowens authored Oct 26, 2019
2 parents f515356 + 909551e commit 80f8d3b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sinatra-contrib/lib/sinatra/respond_with.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,14 @@ def template_for(name, exts)
settings.template_engines[:all].each do |engine|
exts.each { |ext| possible << [engine, "#{name}.#{ext}"] }
end

exts.each do |ext|
settings.template_engines[ext].each { |e| possible << [e, name] }
end

possible.each do |engine, template|
begin
klass = Tilt[engine]
rescue LoadError
next
end
klass = Tilt.default_mapping.template_map[engine.to_s] ||
Tilt.lazy_map[engine.to_s].fetch(0, [])[0]

find_template(settings.views, template, klass) do |file|
next unless File.exist? file
Expand Down

0 comments on commit 80f8d3b

Please sign in to comment.