arc-templates
Fully powered ES6 JavaScript template engine with halfway-decent syntax.




There are two "builds" available: a Node.js 4+ version with minimal Babel transpiling, and an ES5 version with full Babel transpiling. The unit tests are run on both new and older Node versions.
Simple example
Templates can use
expressions:
Hello, ${ name }
with a data object of
{ name: 'world' } will result in:
Hello, world
Loops
JavaScript blocks with nested
document blocks allow a natural expression of loops:
<% for (let item of items) { <:
${item}
:> } %>
Layouts
Templates can define
layouts for a "template of the template":
body
If
layout.html contains:
<**>
Then the final result is:
body
Templates can also define
multiple named blocks for use by the layout template; for example, separate sections for the
head and
body in an HTML document.
Partials
Templates can also
include other templates in their output:
before <( include.html )> after
If
include.html contains:
middle
Then the final result is:
before middle after