Skip to content
More powerful rewrite of Squirrelly
TypeScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
examples
src
test
tools
.editorconfig
.gitignore
.prettierignore
.prettierrc
.travis.yml
CONTRIBUTING.md
LICENSE
README.md
Thoughts.md
code-of-conduct.md
distribution.md
package.json
rollup.config.ts
tsconfig.json
tslint.json
yarn.lock

README.md

Squirrel

squirrelly

styled with prettier Greenkeeper badge Travis Coveralls Dev Dependencies Donate

Summary

Squirrelly is a modern, configurable, and blazing fast template engine implemented in JavaScript. It works out of the box with ExpressJS and the full version weighs only ~2.2KB gzipped.

This is version 8 - a new, more powerful rewrite of Squirrelly. It adds multiple features (like filter parameters, whitespace control, partials, and template inheritance) to bring you a template engine with the power of Nunjucks, the simplicity of EJS, and the small bundle size of its earlier versions.

[Read about why we decided to develop in a separate repository]

[learn about the changes]

Why Squirrelly?

Simply put, Squirrelly is super lightweight, super fast, super powerful, and super simple.

🌟 Features

  • 🔧 Custom helpers
  • 🔧 Custom filters
  • 📦 0 dependencies
  • 🔨 Conditionals
  • ⚡️ Exports ES Modules as well as UMD
  • 🔨 Loops
  • 🔧 Custom delimeters
  • ✏️ Easy template syntax
  • 🔧 Precompilation
  • 🔨 Partials
  • 🔧 Inline JavaScript
  • 🔨 Comments
  • 🔧 Caching
  • 🚀 SUPER fast (look at the performance benchmarks here)

📜 Docs

We know nobody reads through the long and boring documentation in the ReadMe anyway, so head over to the documentation website:

📝 https://squirrelly.js.org

📓 Examples

Simple Template

var myTemplate = "<p>My favorite kind of cake is: {{it.favoriteCake}}</p>"

Sqrl.Render(myTemplate, {favoriteCake: 'Chocolate!'})
// Returns: '<p>My favorite kind of cake is: Chocolate!</p>

Conditionals

{{~if(it.somevalue === 1)}}
Display this
{{#else}}
Display this
{{/if}}

Loops

{{~each(it.somearray) => val, index}}
Display this
The current array element is {{val}}
The current index is {{index}}
{{/each}}

✔️ Tests

Tests can be run with npm test. Multiple tests check that parsing, rendering, and compiling return expected results, formatting follows guidelines, and code coverage is at the expected level.

Resources

To be added

Projects using squirrelly

[Waiting for permissions]

Credits

Made with ❤️ by @nebrelbug and all these wonderful contributors (emoji key):

This project follows the all-contributors specification. Contributions of any kind are welcome!

You can’t perform that action at this time.