Popularity
2.4
Growing
Activity
0.0
-
398
15
73

Description

Squirrelly is a modern, configurable, and blazing fast template engine implemented in JavaScript. It supports helpers, partials, filters, template inheritance, and autoescaping. It works out of the box with ExpressJS and the full version weighs only ~4KB gzipped.

Monthly Downloads: 0
Programming language: TypeScript
License: MIT License
Tags: Templating Engines     Templates     Templating     Ejs     Mustache     Handlebars    
Latest version: v8.0.8

squirrelly alternatives and similar libraries

Based on the "Templating Engines" category.
Alternatively, view squirrelly alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of squirrelly or a related project?

Add another 'Templating Engines' Library

README

squirrelly

Documentation - Chat - RunKit Demo - Playground

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

<!-- ALL-CONTRIBUTORS-BADGE:END -->

GitHub package.json version (master) Travis All Contributors Coveralls Code Shelter 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 ~4KB 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.

Squirrelly v7 will continue to be maintained, and can be found at https://github.com/squirrellyjs/squirrelly/tree/v7.

Read about the changes

Looking for a lightweight, faster, and more reliable alternative to EJS? Check out Squirrelly's cousin, Eta.

Why Squirrelly?

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

🌟 Features

  • πŸ”§ Helpers, filters
  • πŸ”§ Great error reporting
  • πŸ“¦ 0 dependencies
  • πŸ”¨ Conditionals
  • πŸ”§ Better quotes/comments support
    • ex. {{someval + "name }}" }} compiles correctly, while it fails with DoT or EJS
  • ⚑️ Exports ES Modules as well as UMD
  • πŸ”¨ Loops
  • πŸ”§ Custom delimeters
  • πŸ“ Easy template syntax
  • πŸ”§ Precompilation
  • πŸ”¨ Partials
  • πŸ”§ Inline JavaScript
  • πŸ”¨ Comments
  • πŸ”§ Caching
  • πŸš€ Super Fast
    • Squirrelly has been benchmarked against Marko, Pug, doT, Swig, Handlebars, Mustache, and Nunjucks. In each test, Squirrelly was fastest.
  • ⚑️ Async support: async filters, helpers, partials
  • πŸ”§ Template inheritance

πŸ“œ 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]

  • Cypress: Fast, easy and reliable testing for anything that runs in a browser
  • txAdmin: A full featured web panel to manage & monitor your FiveM Server remotely, used by over two thousand servers worldwide
  • Add yours!

Contributors

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

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable --> Ben GublerπŸ’» πŸ’¬ πŸ“– ⚠️ Clite TailorπŸ€” πŸ’» Ioan CHIRIACπŸ’» πŸ€” Lucas WilsonπŸ› πŸ’» Jon McLeanπŸ’» ⚠️

<!-- markdownlint-enable --> <!-- prettier-ignore-end --> <!-- ALL-CONTRIBUTORS-LIST:END -->

Note: because we completely rewrote Version 8 and it has a separate Git history, this chart excludes the dozens of contributors to Version 7. Their contributions are deeply appreciated and many of their ideas and code contributions are being used in Squirrelly v8. Many of their contributions can be found in the v7 branch commit history.

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

Credits

  • Async support and file handling were added based on code from EJS, which is licensed under the Apache-2.0 license. Code was modified to throw informative errors and work with Squirrelly's API


*Note that all licence references and agreements mentioned in the squirrelly README section above are relevant to that project's source code only.