把手预编译模板问题

时间:2013-02-22 11:22:52

标签: handlebars.js precompile

我们在网络应用中使用手柄预编译模板。我们最近破坏了一个元素 - 在某个位置使用了错误的HTML。在查看预编译的js时,我可以看到缺少元素。预编译的HTML非常庞大且复杂,有许多把手操作符。这是一个非常简化的版本:

{{#if isGeneric}}
<!-- SEARCH FOR ME-->
<td class="empty">&nbsp;</td>
<td class="empty">&nbsp;</td>
<!-- THE END FOR ME-->
{{else}}
<td class="description"><p id="{{productId}}" isGeneric="{{isGeneric}}" productType="{{productType}}" class="bluetext productid_opener">{{description}}</p>
<td class="something">{{productName}}</td>
{{/if}}

HTML中的这个代码段非常类似于另一个代码段(如果这有任何区别)。

当我预先编译它并在生成的programXX中搜索HTML时,我无法在任何地方找到代码(例如&#34;搜索我&#34;)。我注意到在特定代码段之前和之后的把手程序都有一个间隙编号。 e.g:

function program52(depth0,data) { // find elements in the condition just prior to the "if" above }
function program54(depth0,data) { // find elements from HTML in condition just after the "if" above }

因此,我假设函数program53包含相关代码,但为什么它不包含在生成的HTML中?把手如何确定HTML中包含或排除的内容?

1 个答案:

答案 0 :(得分:0)

我发布了https://github.com/wycats/handlebars.js/issues/452,这实际上是https://github.com/wycats/handlebars.js/issues/428的伪装。

问题已经解决,很快就会在npm发布。