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}}`?
Bobrtm 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
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150913/f6af3650/attachment.html>