Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor Template, where does it come from?

Tags:

meteor

I have been studying the todos example for Meteor.

http://www.meteor.com/examples/todos

I vaguely understand how to use Template from the example. But where is this declared? I've tried looking at the packages that Meteor uses to find it. I've also searched Google, but there are too many templating systems.

Where is the best place to learn about Template and how it is used with Meteor?

like image 796
Josh Petitt Avatar asked Apr 15 '12 18:04

Josh Petitt


1 Answers

Take a look at the templating Smart Package in packages/templating. It defines the Template global.

Then, it scans all the .html files in your project. For each <template> tag, it compiles the body of the template into a function that returns HTML and stores that function as a property on Template. Later, your JS code will attach helper functions as properties of the Template function (like Template.my_template.my_helper).

Currently, every template element is interpreted as Handlebars. That will change.

like image 82
debergalis Avatar answered Sep 21 '22 17:09

debergalis