- View Offline
…Alright, let's get started building and defining some Dust templates.…Now, it may not surprise you to learn that the way that you define templates in…Dust is pretty similar to the way that…we've been doing it in other templating solutions.…So, there's a script tag.…And, in this case, the type attribute is set to text/x-template.…And it gets an ID, just like we've been doing in Handlebars and Mustache.…But unlike Handlebars and Mustache, Dust only uses a single brace syntax.…So you can see here, I've got some HTML with some place holders for data fields.…
So if I've got my data, which again should look familiar by now.…I've got fields one, two and three, and single…braces surrounding the names of those fields, in the template.…Rendering Dust templates is also pretty straightforward.…However, there's four steps instead of three…like there were in the other libraries.…So step one is to get the template content.…That's pretty common so far, right?…We get the script element, we get its inner HTML, that gives us the template.…
- What is templating?
- Defining templates in jQuery Template
- Using simple Mustache templates with sections and conditions
- Adding conditionals and loops to Handlebars templates
- Working with Dust templates