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


Templating Sandbox

Best Practices


Pre-compile to JS functions

Render server-side

Share templates across server & client

Recommended Reading


https://kippt.com/willklein/templating


Thanks!


@willslab

http://willkle.in

github.com/willklein