Question

In my template files for my Yeoman generator I have if statements to decide whether or not to include some content in the generated files. When the if condition is not satisfied I end up with character returns where the if statement was in the files produced from the template. Is there any way to eliminate these?

Was it helpful?

Solution

It is down to the placement of the if statements this is the way to use them for a list.

<ul>
    <li>HTML5 Boilerplate</li><% if (includeJeet) { %>
    <li>Jeet</li><% } %><% if (includeRespond) { %>
    <li>Respond</li><% } %>
</ul>

If the if statement commences on a new line then the new line is created.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top