Book Image

Instant Handlebars.js

By : Gabriel Manricks
Book Image

Instant Handlebars.js

By: Gabriel Manricks

Overview of this book

Handlebars is one of the leading JavaScript templating engines and is quickly gaining widespread adoption by developers, as well as with frameworks like Ember.js and Meteor. "Instant Handlebars.js" is a complete guide to the Handlebars library filled with internal concepts and practical examples that will help illustrate what's going on and take you from a complete beginner to a Handlebars expert. "Instant Handlebars.js" begins with the very basics, requiring no previous knowledge about templating engines. Throughout the course of this book, you get a thorough tour of all the features available in Handlebars.js and you will learn how to organize your websites for both development and production. In this book, we will cover how to create templates with both placeholders and helpers. We will then go into organizing your projects for rapid -development using Require.js and how to optimize and compile your projects for production. To finish off, you will learn how to annotate your code and leave debug points so that you can easily maintain and troubleshoot your code in the future. Handlebars is a small library;, it is meant to fill a specific need and it does this well. "Instant Handlebars.js" takes a very methodical approach to cover every aspect of this amazing library with practical examples provided every step of the way.
Table of Contents (7 chapters)

Chapter 1. Instant Handlebars.js

Welcome to the Instant Handlebars.js, in this book we will be taking a thorough look through this amazing templating library, as well as ways to manage your projects and optimize them for production.

This book contains the following sections:

So, what is Handlebars? here we will take a look at what a templating engine really is and more specifically why we are learning Handlebars.

Installation we will go through downloading the Handlebars library as-well as installing node.js and the handlebars CLI.

Quick start – creating your first template will get our feet wet, starting off by writing the minimum amount of code required to get a template onto the page, moving on to creating a simple helper.

Top 6 Features you need to know about will take a deep look at all the features Handlebars has to offer, as well as tips on organizing large projects and pre-compiling templates. Topics include:

  • Expressions: These are the core of templates, and a good starting point to get comfortable with the library

  • Helpers: These are where Handlebars gets its extendibility; we will look at all the different types of helpers and settings you have available

  • Partials: These are the building blocks of the templating world, and they open the door for modular design

  • Structuring a Handlebars app: In this section, we will take a look at a number of different ways to structure an app, pointing out the different pros and cons

  • Precompilation: will continue to structure are projects, but with a focus on pre-compiling our resources for a more optimized and efficient site

  • Logging and comments: The final section will be about writing clear and debug-able templates and helpers, so you can easily test and maintain them in the future.

People and places you should get to know will take a look at different people and places you should subscribe to, to stay up-to-date, and learn more.