dust-compiler -s controllers/inbox/views/inbox.dust -d public/js/custom/inbox/messages.js
但我收到错误
if (err) throw err;
^
Error: ENOTDIR, scandir 'C:\jbk\buy2gthr-master\controllers\inbox\views\inbox.dust'
at Error (native)
我有 inbox.dust 文件:
{>"../../../layout/layout"/}
{<css-content}
{/css-content}
{<page-content}
{/<page-content}
<script id="entry-template" type="text/x-tmpl">
{title}
<ul>
{#data}
<li>{name}</li>{~n}
{/data}
</ul>
</script>
**<div id="output"></div>**
{/page-content}
{<script-content}
<script src='/js/custom/inbox/inbox.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/dustjs-linkedin/2.7.2/dust-full.js'></script>
{/script-content}
和收件箱.js 文件
$(document).ready(function () {
var data = {
"title": "Famous People",
"names" : [{ "name": "Larry" },{ "name": "Curly" },{ "name": "Moe" }]
}
var source = $("#entry-template").html();
var compiled = dust.compile(source, "intro");
console.log(compiled);
dust.loadSource(compiled);
dust.render("intro", data, function(err, out) {
if(err) console.log(err);
else
console.log(out);
$("#output").html(out);
});
});
我还在
<div id="output"><ul></ul></div>