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?

有帮助吗?

解决方案

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top