Templates are an integral part of Backbone application development. With Backbone, Underscore.js comes up with its inbuilt micro template engine, though we can use other popular template engines such as Handlebars, Mustache, or Jade too. In the following section, we will cover some interesting patterns with templates that will help you to manage the templates in large applications and enhance their performance.
In the simplest of cases, we store templates in two ways; we either directly add them inline within the view as a view property or add them inside the
script tag in the
index.html file. We have already seen the former case in the previous example. Let's see the second option: