Delivering HTML templates

In the previous sections, you saw how you can package CSS and JavaScript for the browser. At the end of this chapter, we will explore the various ways to deliver HTML. In the context of client-side applications, the templates still contain HTML. However, we need a dynamic way to render and fill them with data.

Defining the templates in script tags

The Ember.js framework adopts the concept of adding HTML templates directly into the page by using the popular handlebars (http://handlebarsjs.com/) template engine. However, since we do not want to mess up the markup that is already there, we place them in the <script> tags. The good thing about this is that if we set a custom value of the type attribute, the browser does not ...

Get Node.js By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.