Squirrelly Logo

Squirrelly

Powerful, lightweight, pluggable JS template engine. Written in TypeScript. Supports helpers, partials, filters, template inheritance, and async templates.

JavaScript Templating: Reimagined

A powerful template engine that combines the best features from Nunjucks, Handlebars, EJS, and Pug:

  • Fantastic Performance - Squirrelly has best-in-class performance, beating other JS template engines in almost all benchmarks
  • Lightweight size - Only 4KB gzipped, despite supporting helpers, filters, partials, template inheritance, and async templates
  • Template inheritance - Nunjucks-style template inheritance with {{@extends}}
  • Powerful filters - Define custom filters like capitalize, join, and more
  • Custom delimiters - Configure your own template delimiters to fit your project needs
  • Plugin support - Extensible plugin system that can be chained together Gulp-style to modify template syntax or minify HTML
  • Whitespace control - EJS-style whitespace trimming for clean output
  • Async support - Full support for asynchronous templates and operations
  • TypeScript types - Written in TypeScript with full type definitions and UMD build
  • Custom tag-type prefixes - Change helpers to begin with ~ instead of @
  • Informative errors - Beautiful error messages that tell you exactly where and what the problem is when tags or comments are left unclosed
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}}
{{! /* Embedded JS templates mean that you can
  write any valid JS expression inside interpolate tags: */ }}

{{ 2 + 4 }}
{{@include("mypartial") /}}

{{@includeFile('./navbar', {pages: [
  'home',
  'about',
  'users'
]}) /}}
{{@extends('layout1', it)}}
This is the content of the page
{{#title}}
Custom Title
{{#description}}
{{it.name}}'s cool site
{{/extends}}