Reusing templates with partials in EJS
Partial templates are larger sections of HTML which need to be included multiple times from multiple pages. Common uses for partial templates include headers, footers, site menus, login boxes, alerts, and so on.
The latest version of EJS doesn't natively support partial templates; they have been removed. However, there is another way to use other templates from within a template, by including the compiled template itself in the data model.
In this recipe, we're going to render a conversation thread using a recursive partial template written in EJS.
We need to download EJS from http://embeddedjs.com/ and extract
ejs_production.js in our
How to do it...
Let's get started.