Skip to content

Working with templates

tbranyen edited this page Nov 14, 2012 · 2 revisions

There are many different template engines and methods of working with templates. In Backbone Boilerplate the preferred template engine is _.template and the preferred method of loading templates is via AJAX during development and through precompiled template functions during production.

Default implementation

The default implementation has templates stored as HTML files inside of app/templates. This directory will be automatically created for you when you use a bbb init:module command. These templates are then loaded via AJAX during development through the custom fetch function inside of app/app.js. During a build all HTML files discovered inside of app/templates get compiled and the fetch function detects the compiled versions and uses those instead of issuing a request.