Templates are a great way to separate your website’s code from its design. There are many great web template systems available for different languages and platforms, including Smarty for PHP and the Django template language for Python.
In this tutorial you’ll explore Mustache, a relatively new and very simple template system that you can easily use to create HTML templates. You’ll look at various topics, including:
- The advantages of using Mustache
- How to install and use the Mustache processor
- How Mustache tags, variables, and data objects work
- Using sections to create conditions and loops
- Including one Mustache template inside another
- …and lots more!
Along the way, you’ll see plenty of code examples that show you how Mustache works. At the end of the tutorial, there’s a complete example that uses Mustache, along with jQuery, to create a simple Ajax-based product list page.