ERB templates and comments

Updated . Posted . Visible to the public.

When you use one line Ruby comments in ERB templates you should never do this (notice the whitespace in front of #):

<% # my comment %>

<div>my html</div>

This leads to strange html output. To avoid long debugging sessions, you should never have a whitespace before the # character (but newline is allowed)

<%# this works as expected %>

<%
    # this works, too
    # foo bar baz
%>
Ulrich Berkmüller
Last edit
License
Source code in this card is licensed under the MIT License.
Posted by Ulrich Berkmüller to makandra dev (2011-12-01 14:16)