用dustc编译这样的模板
$ cat <<EOF | ./node_modules/.bin/dustc -
<p>Hi there!</p>
<p>I'm a {! dust !} template.</p>
EOF产出:
(function(){dust.register("-",body_0);function body_0(chk,ctx){return chk.write("<p>Hi there!</p><p>I'm a template.</p>");}return body_0;})();但是不带在行之间,例如:"<p>Hi there!</p>\n<p>I'm a template.</p>"
有什么办法来改变这个吗?谢谢
发布于 2013-07-16 13:09:12
您可以使用{~n}在尘埃模板中创建换行。它在<pre>标记中特别有用。
发布于 2014-05-19 01:18:22
可以禁用空格压缩
dust.optimizers.format = function(ctx, node) { return node };使用吞咽尘预编译时,有一个preserveWhitespace选项,它就是这样做的:
var compile=require('gulp-dust');
// ...
gulp.src('templates/**/*.dust')
.pipe(compile({ preserveWhitespace: true }))
// ...https://stackoverflow.com/questions/17669364
复制相似问题