2 ms·
I think it solves a practical problem for HTML templates. For example, React embeds HTML templates into JavaScript using JSX. Unlike most template languages th
by skybrian 12y ago
I think it solves a practical problem for HTML templates.
For example, React embeds HTML templates into JavaScript using JSX. Unlike most template languages that generate strings, their templates build a JavaScript tree structure without an intermediate string phase.
This is rather hard to do in a practical way without a language extension, since having a separate file for every tiny HTML template is unwieldy. Also, most alternatives involve building a shadow language [1] into the template language which isn't as elegant as writing code in whichever programming language you're already using.
[1] http://gbracha.blogspot.com/2014/09/a-domain-of-shadows.html http://gbracha.blogspot.com/2014/09/a-domain-of-shadows.html