title: 🚀14 JS Template Engines🚀 published: true date: 2021-01-12 06:04:29 UTC tags: JavaScript,Nodejs,Express,backend canonical_url: https://h.shadowtime2000.com/14-js-template-engines
🚀14 JS Template Engines🚀
This is a list of 14 JS template engines.
EJS
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 is an extension of the Mustache template engine with some modifications to partials and a couple more features.
Pug/Jade
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
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 is a template engine which uses a mixture of embeddable JS and some predefined syntax within tags.
Nunjucks
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 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 is a semi-embeddable template engine which emphasizes on low bundle size (4KB), pluggability, configurability, and fast performance.
Eta
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
Back | DEV.toshadowtime2000
If you are looking at this you probably wonder who I am; teenage open source maintainer