是否可以在 Lodash 模板中编写 IF 条件 (_.template)?

Is it possible to write IF conditions inside Lodash templates (_.template)?

类似于:

<div>
    <%- if (condition) { %>
        <div>This text will be shown if `condition` is true</div>
    <%- } %>
</div>

上面的例子不起作用,所以我想问一下是否有任何方法可以在模板字符串中使用 IF 条件,我知道 Underscore 开箱即用地支持它。

使用这个:

<% if (condition) { %>...<% } %>

(换句话说:删除连字符)