discourse/lib/freedom_patches/better_handlebars_errors.rb

17 lines
510 B
Ruby
Raw Normal View History

2014-12-10 11:34:00 -05:00
module Ember
module Handlebars
class Template < Tilt::Template
# Wrap in an IIFE in development mode to get the correct filename
def compile_ember_handlebars(string, ember_template = 'Handlebars')
2014-12-10 11:34:00 -05:00
if ::Rails.env.development?
"(function() { try { return Ember.#{ember_template}.compile(#{indent(string).inspect}); } catch(err) { throw err; } })()"
2014-12-10 11:34:00 -05:00
else
"Ember.#{ember_template}.compile(#{indent(string).inspect});"
2014-12-10 11:34:00 -05:00
end
end
end
end
end