SquirrellyJS

Powerful, lightweight, pluggable JS template engine

Written in TypeScript. Supports helpers, partials, filters, template inheritance, and async templates.

Squirrel
Hi {{it.user}}!
<ul>
{{@each(it.user.friends) => friend}}
<li>{{friend.first | capitalize}} {{friend.last}}</li>
{{/each}}
</ul>
Here are your badges:
{{it.badges | join(", ") | capitalize}}

Interactive Playground

var Sqrl = require("squirrelly")
Sqrl.render("Hi {{it.user}}", {user: "Ada Lovelace"})

JavaScript Templating: Reimagined

We drew inspiration from template engines like Nunjucks, Handlebars, EJS, and Pug to create a template engine with the best parts of each.

Squirrelly is what we like to call a semi-embedded template engine. It has a rich syntax, but allows you to use valid JavaScript syntax inside of your templates. All Squirrelly templates compile into plain, understandable JavaScript.

A Few Features
  • Lightweight size: only 4KB gzipped
  • Very fast parsing and compilation. Check out these benchmarks
  • Template inheritance (kinda Nunjucks-style?)
  • Fantastic partial, layout, and file handling support, based off EJS'
  • Express.js support with high performance
  • Async support
  • TypeScript types and UMD build
  • Custom delimiters
  • Whitespace control, EJS-style
  • Custom tag-type prefixes. Example: you could change helpers to begin with ~ instead of @
  • Beautiful informative errors. If you accidentally leave a tag, string, or multiline comment unclosed, Squirrelly will tell you where and what the problem is
[object Object]

Fantastic Performance

Squirrelly has best-in-class performance, and beats other JS template engines in almost all benchmarks! Read more here

[object Object]

Powerful Syntax

Squirrelly's template syntax takes inspiration from Nunjucks, Handlebars, Django, and Swig.

[object Object]

Powerful and Lightweight

Squirrelly weighs less than 4 KB gzipped, despite supporting helpers, filters, partials, template inheritance, and asynchronous templates.

[object Object]

Configurable and pluggable

Squirrelly has many configuration options. You can control whitespace trimming, use custom delimiters, add plugins, or toggle caching -- without any convoluted external APIs. Squirrelly also supports plugins, which can be chained together Gulp-style to modify template syntax, minify HTML, or do pretty much anything else!