# Trimming whitespace in my view template

**URL:** <https://www.ruby-forum.com/t/trimming-whitespace-in-my-view-template/89734>\
**Category:** Rails\
**Created:** [March 22, 2007, 12:03pm UTC](https://www.ruby-forum.com/t/trimming-whitespace-in-my-view-template/89734 "2007-03-22T12:03:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chovy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecd19e/32.png) [@chovy](https://www.ruby-forum.com/u/chovy)\
**Post date:** [March 22, 2007, 12:03pm UTC](https://www.ruby-forum.com/t/trimming-whitespace-in-my-view-template/89734/1 "2007-03-22T12:03:07Z")

</div>

\<% for ... %\> - ..
 \<% end %\> - ..
- ..

The above sample ends up giving me double spacing between the

-   
elements.

I was told that \<% for -%\> will remove them, but it is also adding  
more tabs in the loop…so my generated html looks like:

- ...
- ...
- ...
- ...
- ...

I realize this is rather insigificant but my sources is more difficult  
to read when debugging if tabstop is not the same.

What I want is:

- ...
- ...
- ...
- ...
- ...

---

<div class="post-metadata">

**Author:** ![chovy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ecd19e/32.png) [@chovy](https://www.ruby-forum.com/u/chovy)\
**Post date:** [March 22, 2007, 12:15pm UTC](https://www.ruby-forum.com/t/trimming-whitespace-in-my-view-template/89734/2 "2007-03-22T12:15:13Z")

</div>

On Mar 22, 4:02 am, “chovy” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 

Update: I found this works, but would like to set this behavior as the  
default if possible…

\<%- for … -%\>

- ..
\<%- end -%\>

The “-” strips beg/end white space.although a link to documentation on  
its usage would be good.
