middleman/middleman-core/lib/middleman-core/renderers/erb.rb
2014-07-05 13:41:59 -07:00

22 lines
578 B
Ruby

# ERb renderer
module Middleman
module Renderers
class ERb < ::Middleman::Extension
def after_configuration
::Tilt.prefer(Template, :erb)
end
class Template < ::Tilt::ErubisTemplate
##
# In preamble we need a flag `__in_erb_template` and SafeBuffer for padrino apps.
#
def precompiled_preamble(locals)
original = super
"__in_erb_template = true\n" << original
# .rpartition("\n").first << "#{@outvar} = _buf = ActiveSupport::SafeBuffer.new\n"
end
end
end
end
end