Skip to content
Our free WordPress themes are downloaded over 5 MILLION times. Get them now!
Best Free JavaScript Frameworks
Colorlib content is free. When you buy through links on our site, we may earn an affiliate commission. Learn More

JavaScript Templating Engines: Which Ones Still Matter in 2026?

Last updated: March 2026

JavaScript Templating Engines in 2026: Which Ones Still Matter?

JavaScript templating engines have been around since the early days of Node.js, and their relevance in 2026 is a genuine question. React, Vue, and Svelte dominate client-side rendering. Server-side rendering frameworks like Next.js and Nuxt handle full-stack needs. So who still uses templating engines, and why?

The answer: millions of developers. EJS alone gets 25 million npm downloads per week. Shopify’s Liquid powers over 4 million storefronts. Pug remains the go-to for teams that despise writing HTML angle brackets. Templating engines thrive where you need server-rendered HTML without the overhead of a full frontend framework — email templates, static site generators, admin panels, CMS themes, and multi-page applications that do not need client-side interactivity.

For broader industry context, see our web development statistics report.

Templating Engine Comparison Table

EngineLast Updatednpm Weekly DownloadsSyntax StyleServer / ClientUse Case
EJS2024~25MEmbedded JS (<%= %>)BothExpress apps, quick server rendering
Pug2023~6MIndentation-based (no HTML tags)BothTeams who prefer concise markup
Handlebars2024~12MMustache-compatible ({{ }})BothCMS themes, email templates
Nunjucks2023~2MJinja2-like ({% %})BothStatic site generators (11ty)
Liquid2025~800KShopify-style ({{ }} / {% %})ServerShopify themes, Jekyll
Mustache2023~8MLogic-less ({{ }})BothSimple token replacement, multi-language
doT.js2021~500KCustom delimiters ({{ }})BothPerformance-critical rendering
Eta2025~3.5MEJS-compatible (<%= %>)BothModern EJS replacement, TypeScript-native

EJS (Embedded JavaScript)

EJS is the most popular templating engine by download count and the default choice for Express.js applications. Its syntax embeds JavaScript directly in HTML using <%= %> for output and <% %> for logic. There is almost no learning curve if you know JavaScript and HTML — the template is just HTML with JavaScript sprinkled in.

EJS compiles templates to plain JavaScript functions, which means excellent runtime performance. It supports partials (<%- include('header') %>), layouts via community packages, and works identically on server and client. The downside: EJS templates can become messy because the syntax encourages mixing logic and presentation. There are no built-in layout or block inheritance features — you need workarounds or plugins for those.

StrengthWeakness
Zero learning curve for JS developersNo built-in layout inheritance
Huge ecosystem, tons of tutorialsEasy to write spaghetti templates
25M+ weekly downloadsLast major update 2024
Works with any frameworkNo compile-time type checking

Pug (formerly Jade)

Pug replaces HTML’s angle bracket syntax with indentation-based markup. A div.container in Pug compiles to <div class="container"></div>. This brevity appeals to developers who find HTML verbose, and Pug templates are typically 30-40% shorter than equivalent HTML. Pug also includes built-in mixins, template inheritance, conditionals, and iteration — a complete templating toolkit.

The trade-off is readability for newcomers and designers. Anyone comfortable with HTML will find Pug’s syntax foreign. Whitespace sensitivity means indentation errors cause silent rendering bugs. And Pug’s compilation step is noticeably slower than EJS or Handlebars, though this only matters during development with large template sets.

StrengthWeakness
Dramatically less markup to writeSteep learning curve for non-developers
Built-in mixins, inheritance, filtersWhitespace-sensitive (indentation bugs)
Strong Express.js integrationSlower compilation than alternatives
Active community, 6M weekly downloadsDesigners cannot edit templates directly

1. Handlebars

handlebars screenshot

Handlebars extends the Mustache templating language with helpers, partials, and block expressions while maintaining backward compatibility with Mustache templates. Its “logic-less” philosophy keeps templates clean by pushing complex logic into helper functions defined in JavaScript. This separation makes Handlebars templates the most readable option for content-focused rendering.

Handlebars shines in email templating (MJML and many email builders use it), CMS theming (Ghost uses Handlebars), and any context where non-developers need to edit templates safely. The precompilation feature converts templates to JavaScript functions at build time, eliminating runtime parsing overhead.

StrengthWeakness
Clean, readable templatesLimited built-in helpers (needs custom helpers for most logic)
Precompilation for performanceVerbose for complex conditionals
Safe for non-developer editingNo inline JavaScript expressions
Mustache-compatibleEcosystem feels stagnant compared to newer options

2. Nunjucks

nunjucks screenshot

Nunjucks is Mozilla’s JavaScript port of Python’s Jinja2 templating engine. If you have worked with Django, Flask, or Ansible templates, Nunjucks will feel immediately familiar. It features template inheritance ({% extends %}), blocks, macros, filters, and auto-escaping — a complete feature set that rivals Pug without the custom syntax.

Nunjucks is the default templating engine for Eleventy (11ty), the popular static site generator. This ecosystem connection keeps Nunjucks relevant despite relatively modest standalone download numbers. Its macro system is particularly powerful — you can define reusable template components with arguments, similar to React components but in pure HTML.

3. Liquid

liquid screenshot

Liquid was created by Shopify and powers every Shopify storefront theme. It also drives Jekyll (GitHub Pages’ default static site generator). Liquid’s distinguishing feature is safety — it is designed to be run on servers with untrusted template code, so it sandboxes template execution and prevents file system access or arbitrary code execution.

For Shopify developers, Liquid is non-negotiable — it is the only way to build themes. Outside Shopify, Liquid competes with Nunjucks and Handlebars for general-purpose server rendering. Its filter-based syntax ({{ "hello" | upcase }}) is intuitive and reads left-to-right, making templates easy to follow even for non-programmers.

4. Mustache

mustache screenshot

Mustache is the original “logic-less” template engine. It has implementations in over 40 programming languages, making it the best choice when the same template needs to render in JavaScript, Ruby, Python, Go, and other languages. The spec is frozen — Mustache templates written in 2012 work identically today.

Mustache’s simplicity is both its strength and limitation. There are no if/else statements, no loops, no expressions — only sections ({{#list}}...{{/list}}) that iterate arrays or toggle on boolean values. Everything else must be pre-computed in the view model. This forces clean data preparation but frustrates developers who need even basic conditional logic.

5. doT.js

doT.js is the fastest JavaScript templating engine in benchmarks. It achieves this by compiling templates to raw JavaScript functions with minimal overhead — no virtual DOM, no safety wrappers, no helper resolution. If you need to render thousands of templates per second (real-time data dashboards, log viewers, high-frequency server responses), doT.js is measurably faster than alternatives.

The trade-off: doT.js has a minimal feature set, sparse documentation, and has not been actively developed since 2021. It is a surgical tool for performance-critical rendering, not a general-purpose engine. Use it when benchmarks prove other engines are too slow — not as a default choice.

6. Eta

Eta is the modern successor to EJS. It uses the same <%= %> syntax but is written in TypeScript, supports async/await natively, handles layouts and partials without plugins, and weighs just 3.5 KB gzipped (compared to EJS’s 12 KB). Eta is actively maintained in 2025 and adds features EJS lacks: automatic caching, file handling, custom delimiters, and a plugin system.

If you are starting a new project and leaning toward EJS, consider Eta instead. It is a drop-in replacement that handles every EJS use case while adding TypeScript support and better error messages. The migration path from EJS to Eta is straightforward — most templates work without changes.

When to Use a Templating Engine vs React/Vue

This is the question every developer faces in 2026. The answer depends on what your application needs from the browser.

ScenarioBest ChoiceWhy
Content site, blog, documentationTemplating engine (Nunjucks, EJS)Server-rendered HTML is simpler and faster for read-heavy pages
E-commerce storefrontLiquid (Shopify) or templating + HTMXServer rendering with minimal client JS for speed
Admin dashboard with real-time dataReact/Vue/SvelteComplex client-side state management needed
Email templatesHandlebars, MJML, EJSEmail clients do not run JavaScript
Static site generationNunjucks (11ty), Liquid (Jekyll)Build-time rendering, zero runtime JS
Multi-language backendMustacheSame templates work in any language
Node.js API returning HTML fragmentsEJS or EtaLightweight, no framework overhead
Full SPA with complex interactionsReact/Vue/SvelteComponent model, state management, routing
Server-rendered app with islands of interactivityTemplating + HTMX or Alpine.jsServer rendering for most pages, JS only where needed

The resurgence of server-side rendering frameworks like HTMX, Hotwire, and LiveView has actually increased the relevance of templating engines. These tools generate HTML on the server and swap it into the page — exactly what templating engines are built for. An Express + EJS + HTMX stack can build surprisingly interactive applications without a single React component.

Migration Paths

If you are maintaining an older project with one of these engines and considering migration, here is the practical reality of each path.

FromToDifficultyNotes
EJSEtaEasyDrop-in replacement, most templates work unchanged
MustacheHandlebarsEasyHandlebars is Mustache-compatible
JadePugTrivialRename, same syntax
Any engineReact/VueFull rewriteFundamentally different paradigm
NunjucksLiquidModerateSimilar syntax, different filter/tag names
Any engineHTMX + same engineLowAdd HTMX attributes, keep existing templates

The Bottom Line

Templating engines are not going away. They serve a different architectural niche than component frameworks, and that niche — server-rendered HTML with minimal client JavaScript — is actually growing thanks to the HTMX and “HTML over the wire” movement. For new projects, Eta is the best general-purpose choice (modern, fast, TypeScript-native). For static sites, Nunjucks with Eleventy is the strongest ecosystem. For Shopify, Liquid is the only option. And for email templates, Handlebars remains the industry standard.

The worst choice is picking a framework like React when a templating engine would suffice. If your page does not need client-side interactivity, server-rendering with a template engine will be faster to build, faster to load, and easier to maintain.

Was this article helpful?
YesNo

Alex is a freelance writer with more than 10 years of experience in design, development, and small business. His work has been featured in publications like Entrepreneur, Huffington Post, TheNextWeb, and others. You can find his personal writing at The Divine Indigo.

Comments (21)

    1. Nunjucks FTW! Most flexible templating engine IMHO.

  1. It is sad that NunJucks from Mozilla is not in the list.

    1. Kevin,

      Please let us know why you believe NunJucks should be listed there and we’ll make sure to add it once we do the next update for this article.

      1. Mats Lindblad says:

        Because nunjucks is versatile and fast. Really fast. Is running two different projects using handlebars and nunjucks and the difference is remarkable. ☺️

  2. Dian Dimitrov says:

    Most of the js template engines are a bit old-fashioned but have a charm on their own. A new player has arrived on the market that makes an use of the new ES6 syntax and is as twice as fast as Pug One of the great things about it is the attempt to mitigate the learning curve of learning new syntax that have scared many developers (like me) away. Have a loot at it here: https://github.com/dondido/express-es6-template-engine

    1. Another vote for express-es6-template-engine – it’s extremely lightweight and blazingly fast. The name is a bit misleading thou. Recently, I’ve switched from express to pure nodejs server and still was able to use it.

  3. Joe Edrick says:

    I just wanted to write HTML with basic conditionals and template options, but was scared a little by the complexity of a lot of the Express template engines I found, so I made my own 😀
    https://www.npmjs.com/package/squirrelly
    It works with Express out of the box and is super simple

  4. Moxy Boxy says:

    I believe one of the reasons Handlebars is so “popular” on github and npm is that you require a ton of helpers to do even the simplest of tasks. You can’t even do multiple if:s and === conditions around a node without some helpers.

  5. Why Rivets is not listed, I think it is easier and better than all of these complicated libraries

  6. meenal deshpande says:

    Java is been a old as well as great platform to start career. It seems you have done good research on java.
    Thanks for posting

    1. Toni Montana says:

      Javascript is not Java.

      1. yup, …..and you’re replying to bot

  7. Also a huge Nunjucks fan. At least for my email template rendering.

  8. Tahir Alvi says:

    I personally like the Handlebars and jQuery Templating.

  9. Mind Floss says:

    So, you give us 14 templating engines to choose from, but seem to market and tout them all without providing any real or tangible reasons why we would favor one over the other. Pros and cons? Github statistics?? Anything to show in some way which ones are more popular, what disadvantages might exist, or something! Instead the reader is left no better than before, wondering which of these 14 options to pick from. 14 is a lot. Unless your whole goal was just to list the template engine in one place, or drive traffic to your website.

  10. Ben Gubler says:

    Hey there! I just wrote Eta (https://eta.js.org), a more lightweight and faster alternative to EJS. It’s written in TypeScript, adds plugin support, throws great errors, and supports async templates and partials out-of-the-box. It also works with Express by default.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top

If you wish to withdraw your consent and stop hearing from us, simply click the unsubscribe link at the bottom of every email we send or contact us at [email protected]. We value and respect your personal data and privacy. To view our privacy policy, please visit our website. By submitting this form, you agree that we may process your information in accordance with these terms.