Skip to main content

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 supports Deno, out-of-the-box
  • 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>