0

我们在 Web 应用程序中使用车把预编译模板。我们的一个元素最近损坏了 - 在某个位置使用了不正确的 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 中的这个片段与另一个片段非常相似(如果这有什么不同的话)。

当我预编译它并在生成的 HTML 中搜索时programXX,我在任何地方都找不到代码(例如“为我搜索”)。我注意到在特定代码部分之前和之后的车把程序都有一个间隙编号。例如:

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 中包含或排除的内容?

4

1 回答 1

0

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

该问题已解决,并将很快在 npm 中可用。

于 2013-02-26T07:30:01.633 回答