Eta

Lightweight, powerful, pluggable embedded JS template engine.

Written in TypeScript – for use in Node, Deno, or the browser

η

A faster, more lightweight, and more configurable EJS alternative

Eta vs. EJS:

  • Eta's more lightweight, weighing in at only 2.4KB gzipped
  • Eta supports Deno, out-of-the-box
  • Eta's much faster at compiling and rendering than EJS. Check out these benchmarks
  • Eta supports layouts out of the box (learn more)
  • Eta allows left whitespace control (with -), something that doesn't work in EJS because EJS uses - on the left side to indicate that the value shouldn't be escaped. Instead, Eta uses ~ to output a raw value
  • Eta gives you more flexibility with delimeters -- you could set them to {{ and }}, for example, while with EJS this isn't possible
  • Eta adds plugin support
  • Comments in Eta use /* ... */ which allows multiline commenting and is more consistent
  • Eta doesn't break with delimiters inside strings and comments. Example: <%= "%>" %> works in Eta, while it breaks in EJS
  • Eta exposes Typescript types and distributes a UMD build
  • Eta allows custom tag-type prefixes. Example: you could change <%= to <%*
  • Eta throws more informative errors. If you accidentally leave a tag, string, or multiline comment unclosed, Eta will tell you where the problem is
Users:
<ul>
<% it.users.forEach(function(user){ %>
<li><%= user %></li>
<% }) %>
</ul>
[object Object]

Unbeatable Performance

Benchmarks demonstrate just how fast Eta is. Think fast, then multiply by crazy speedy, and you have an idea of Eta's performance.

[object Object]

Simply JavaScript

Eta's template syntax (inspired by EJS) means you write templates with just JavaScript -- you don't have to learn an entirely new template syntax.

[object Object]

Powerful and Lightweight

Eta was designed by the team who created Squirrelly, as an alternative to EJS. Though it has almost-compatible syntax to EJS, it's more configurable and has a minzipped bundle cost of only ~2KB!

[object Object]

Configurable and pluggable

Eta supports plugins, custom delimiters, caching, and so much more!