Template Engines  in 5 Minutes


Will Klein

What is templating?


Take HTML (or something like it)

dynamic data (typically JSON)

and bind them together.

Pseudo-example


Ever do this?

'<a href="' + link.url + '">' + link.text + '</a>'


Instead, let's do this:

<a href="{{ link.url }}">{{ link.text }}</a>



Choose a Flavor


Mustache

Jade

Transparency

Let's Compare


Best Practices


Pre-compile to JS functions

Render server-side

Share templates across server & client

Recommended Reading




Thanks!




Template Engines in 5 Minutes

By Will Klein

Template Engines in 5 Minutes

Lightning talk shared at HartfordJS and New Haven JS in May/Jun 2013

  • 3,581