🚀14 JS Template Engines🚀
This is a list of 14 JS template engines.
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 is an extension of the Mustache template engine with some modifications to partials and a couple more features.
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.
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 is a template engine which uses a mixture of embeddable JS and some predefined syntax within tags.
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 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 is a semi-embeddable template engine which emphasizes on low bundle size (4KB), pluggability, configurability, and fast performance.
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 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 is another JS template engine with syntax like Nunjucks.
DustJS is another "logic-less" template engine but has support for advanced features such as async streaming.
You might also like: