mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
16 lines
510 B
Ruby
16 lines
510 B
Ruby
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')
|
|
if ::Rails.env.development?
|
|
"(function() { try { return Ember.#{ember_template}.compile(#{indent(string).inspect}); } catch(err) { throw err; } })()"
|
|
else
|
|
"Ember.#{ember_template}.compile(#{indent(string).inspect});"
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|