我想抽象一些代碼,並希望利用dust.helpers渲染一個parial。DustJS:渲染部分通過幫助器
我的當前設置:
{> "includes/components/link" /}
我理想設置:
{@uiComponent name="link" /}
我的助手:
dust.helpers.uiComponent = function (chunk, context, bodies, params) {
return dust.render('includes/components/' + name, context, function (err, out) {
chunk.end(out);
});
};
我也嘗試了一些其他的東西,沒有用。
是的,我試着看文檔。 :(
任何建議,將不勝感激!
你要處理的部分以一種特殊的方式還是這只是抽象掉 – Interrobang
主要是抽象的文件路徑的路徑...但目前想擁有這個例如,如果需要,可以操縱數據。 – peduarte