Reputation: 18595
Can I do something like:
<script type="text/template" id="header">
yo
</script>
<script type="text/template" id="body">
{>"header"/}
whats up
</script>
<script>
// I'm just citing a backbone example...
this.z = 'x';
dust.loadSource(dust.compile($('#body').html(),this.z));
dust.render(this.z, null, function(err, out) {
_self.$el.html(out);
});
</script>
<script src="dust-full-1.2.0.js"></script>
Is it possible to render partials in a similiar way without precompiling partial?
Is there a recursive way to precompile dependant partials when using dust.render()
?
Upvotes: 0
Views: 554
Reputation: 5999
No Dan, you need to compile all the templates. Because dust will look for the templates in the dust's cache. So if you don't compile the partial and load it in the cache (with loadsource) it will not find it. I have being using backbone with dust, and I using a nodejs script that compiles automatically all my templates when I save them. you can see it here: https://github.com/dmix/dusterjs
Upvotes: 1