Mustache templates: How to output a block only once for non-empty lists
问题 If my list is empty, I want to output this: <div id="some-id"> </div> If my list is non-empty, I want to output this: <div id="some-id"> <ul> <li>Item 1</li> <li>Item 2</li> <li>etc</li> </ul> </div> Note that I output the <ul> and </ul> tags at most once , and only if the list is non-empty. The following code is close to how I would do this in PHP, but is obviously wrong: <div id="some-id"> {{#items}} <ul> {{/items}} {{#items}} <li>{{name}}</li> {{/items}} {{#items}} </ul> {{/items}} </div>