Quick start – creating your first template

Let's start from the beginning. The purpose of using a templating engine such as Handlebars is to generate some kind of viewable content (usually HTML pages), dynamically. This encompasses a really broad range of uses, from e-mail newsletters, web apps, and really any other kind of output format around.

In this quick start, we will take a brief look at the process of creating a template with both placeholders and helper tags, and then how to run and output the contents to the page.

Preparing the project

To get started, create a file named index.html and add the following boilerplate code:

<!DOCTYPE HTML> <html> <head> <title>Handlebars Quickstart</title> <script src="handlebars.js"></script> </head> <body> ...

Get Instant Handlebars.js 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.