0

All my Dustjs templates are kept precompiled in a database. To render the template I have this function

tmplfn(options, function (err, html) {
    res.write(html);  //res is the response object
    res.end();
});

But this fails when the templates have got partials in it because it is not able to locate the partial. How can I resolve this issue? Is there any mechanism to register my partial with the dustengine?

Golak Sarangi
  • 809
  • 7
  • 22

1 Answers1

0

I'm not familiar with dust.js myself, but according to the docs:

dust.onLoad(name, callback(err, out))

By default Dust returns a "template not found" error when a named template cannot be located in the cache. Override onLoad to specify a fallback loading mechanism (e.g., to load templates from the filesystem or a database).

This seems to me like a good starting point.

Community
  • 1
  • 1
Linus Thiel
  • 38,647
  • 9
  • 109
  • 104