Compiling a HTML+ERB document using the Herb::Engine always emits the __herb = ::Herb::Engine; preamble.
For example in a document like:
<h1>
<% if true %>
<div>Text1</div>
<% elsif false %>
<div>Text2</div>
<% else %>
<div>Text3</div>
<% end %>
</h1>
This gets compiled to:
__herb = ::Herb::Engine; _buf = ::String.new;
_buf << '<h1>
'.freeze; if true; _buf << '
<div>Text1</div>
'.freeze; elsif false; _buf << '
<div>Text2</div>
'.freeze; else; _buf << '
<div>Text3</div>
'.freeze; end; _buf << '
</h1>
'.freeze;
_buf.to_s
We could omit the preamble if we notice that we aren't using it in the compiled Ruby template.
Compiling a HTML+ERB document using the
Herb::Enginealways emits the__herb = ::Herb::Engine;preamble.For example in a document like:
This gets compiled to:
We could omit the preamble if we notice that we aren't using it in the compiled Ruby template.