Reputation: 12240
I have a dustjs template heirarchy like so:
layout.dust
...
{> "book/BookListings" /}
...
Then, BookListings.dust:
{#books}
{> "templates/OneBook" /}
{/books}
I have several books to display in BookListings. For every Book, I use OneBook
template. It all works fine when I run it for the first time.
Problem arises when I try to reuse the compiled template on the front-end in a Single Page App mode.
I use dustc
to compile BookListings
template using the command:
dustc BookListings.dust BookListings.js
On the front end, when I try to load the template, I get the error:
Dust Error: Error {stack: (...), message: "Template Not Found: templates/OneBook"}
Please advise.
Upvotes: 0
Views: 55
Reputation: 17434
Compiling a template does not compile its partials together with it.
You would still need to compile the OneBook
template and include it on the page at runtime so it will be registered.
You can use the --name
flag to tell the compiler that the template should be named templates/OneBook
(this is just a name, even though it looks like a path).
Upvotes: 0