Search code examples
yeomanyeoman-generator

Character Returns In Yeoman Templates


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?


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.