Book Image

Meteor Cookbook

By : Isaac Strack
Book Image

Meteor Cookbook

By: Isaac Strack

Overview of this book

Table of Contents (19 chapters)
Meteor Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Inserting templates with Spacebars


Spacebars is Meteor's templating language. All Document Object Model (DOM) elements in Meteor are created programmatically using Meteor's default templating engine, Blaze. Elements can therefore be created using pure JavaScript. Using JavaScript to create HTML elements, however, isn't exactly quick and easy.

Inspired by the popular HTML templating language Handlebars, Spacebars makes it incredibly easy to structure and declare your HTML elements using templates. And, it gives you access to all the reactive and dynamic features of Meteor. This recipe will show you how to create templates using the Spacebars syntax.

Getting ready

You will need Meteor installed and have a project created. We recommend that you have a simple project, similar to the one found in the Setting up your project file structure recipe in Chapter 1, Optimizing Your Workflow, but any project will do. You will need to locate your <body> tag, which is usually found inside your main...