Template strings as a template language.

Bob Myers rtm at gol.com
Sun Sep 13 15:58:04 UTC 2015

Templating languages typically "compile" templates into functions through
various lexical transformations.

Consider a template file foo.tem:

My name is ${this.name}.

Lexically transform this into

function foo() {
  return `My name is ${this.name|}.`;

Then invoke the template as eg

foo.call({name: 'Bob'})

Having said that, I doubt if ES6 template strings serve as a useful basis
for a full-fledged templating system. To take just one basic example, how
would one implement the equivalent of `{{#if}}`?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150913/f6af3650/attachment.html>

More information about the es-discuss mailing list