Bob Myers (2015-09-13T15:58:04.000Z)
rtm at gol.com (2015-09-13T17:57:11.668Z)
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}}`? Bob
rtm at gol.com (2015-09-13T17:56:38.020Z)
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}}`? Bob