🚀14 JS Template Engines🚀

·

4 min read

🚀14 JS Template Engines🚀

This is a list of 14 JS template engines.

EJS

EJS Logo

EJS is a pretty popular template engine, it stands for Embeddable JavaScript because it runs with just JavaScript inside it's tags.

Mustache

Mustache is actually a template engine specification with implementations of that spec in multiple different programming languages. It does have an implementation in JS. It uses "logic-less" templates where there are predefined ways to do stuff with data such as looping and displaying.

Handlebars

Handlebars Logo

Handlebars is an extension of the Mustache template engine with some modifications to partials and a couple more features.

Pug/Jade

Pug Logo

Pug is one of the template engines which is meant only for HTML rendering. It uses indented whitespace sensitive syntax to write tags and such. It's typically called Pug/Jade because it's previous name was Jade before it was changed to Pug because of copyright issues. The templating part allows you to write JS inside of it to use data to render stuff.

Lodash

Lodash Logo

You may be thinking, Lodash is a JS utility library so why is it listed as a template engine? Well, Lodash has a utility known as lodash.template which is pretty much like EJS.

doT

doT Logo

doT is a template engine which uses a mixture of embeddable JS and some predefined syntax within tags.

Nunjucks

Nunjucks Logo

You have probably heard of this template engine if you have used 11ty because it seems to be mainly used there. Nunjucks was created by Mozilla and is inspired by Jinja2, a Python template engine. It uses predefined syntax within tags.

Liquid

Liquid Logo

Liquid is another cross language template engine with the original implementation being written in Ruby and various JS ports existing. It uses syntax kind of like Nunjucks.

Squirrelly

Squirrelly Logo

Squirrelly is a semi-embeddable template engine which emphasizes on low bundle size (4KB), pluggability, configurability, and fast performance.

Eta

Eta Logo

Eta is an embeddable template engine with almost completely compatible syntax of EJS and emphasizes on low bundle size (<3KB minzipped), pluggability, configurability, and fast performance. Interestingly Eta is created by the same person who made Squirrely, and intended Eta to be a lot smaller. Eta has a very similar codebase when compared with Squirrelly.

(Diclaimer: I am a maintainer of Eta)

Hogan

Hogan is a JS implementation of the Mustache spec by Twitter. It has the same syntax and stuff, but the implementation with rendering and compilation is different.

Swig

Swig is another JS template engine with syntax like Nunjucks.

ECT

ECT is an embeddable template engine which uses CoffeeScript instead of JavaScript for embedded code.

Dust

DustJS is another "logic-less" template engine but has support for advanced features such as async streaming.

You might also like:

How to Create a Template Engine in JS