-%> what this "-" for?

hello

what this “-” for?

thanks!

On Sun, Jun 14, 2009 at 3:54 PM, tivrfoa[email protected] wrote:

hello

what this “-” for?

thanks!

-%> strips the trailing whitespace and newline.

<%- strips leading whitespace but not newline.

So
<% if foo %>
bar
<% end %>
generates " \n bar\n \n" whereas
<%- if foo -%>
bar
<%- end -%>
generates " bar\n"

This is especially useful in templates for plain-text emails.

jeremy

Thanks Jeremy! So it has no effect in html.erb files, i.e., in the
views, right? I tested here and nothing changed.

Here is a page that maybe can help someone:
http://springyweb.com/documents/1