Dust.js @sep 示例无效

Dust.js @sep example not working

我尝试在第一页 hello world 中使用 Dust.js 模板引擎,但未能使用 {@sep} 标记,模板已编译并生成输出,但没有逗号 {@sep},{/sep}

http://jsfiddle.net/t1qh9abw/

$(document).ready(function () {

    var template = "Dust does {#features}{name}{@sep},{/sep}{/features}!"

    var compiled = dust.compile(template, "test");
    dust.loadSource(compiled);

    dust.render("test", {
      features: [
        {name: "async"},
        {name: "helpers"},
        {name: "filters"},
        {name: "a little bit of logic"},
        {name: "and more"}
      ]
    },
    function (err, out) {
        document.getElementById('container').textContent = out;
    });
});

{@sep},{/sep}似乎没有产生任何东西,输出是

Dust does asynchelpersfiltersa little bit of logicand more!

而实际主页的示例输出 http://www.dustjs.com/ 似乎工作正常,这表明我自己的代码或我正在使用的版本有问题。

然后我认为 CDN 可能正在提供过时的文件,所以我尝试使用 rawgit.com link

直接使用 GitHub 的最新版本

http://rawgit.com/linkedin/dustjs/master/dist/dust-full.js

例子在这里:http://jsfiddle.net/5apgp1sf/它仍然没有输出@sep标签内容。

出了什么问题?我看不到逗号,所以我应该去买眼镜还是提交错误报告?

好的,我会自己回答这个问题。我在 Dustjs 主页上做了一些研究并弄清楚了。

不是很明显,即使有像

这样的包
  • 尘埃核心
  • 尘土飞扬

完整包似乎实际上并不包含@sep定义,即使那是首页示例。

所以,导入文件 dust-helpers.js 为我解决了这个问题。