You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
π― Check out ts-base β A TypeScript library starter template featuring Biome, Vitest, tsdown, and automated releases.
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.
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
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
About
Semi-embedded JS template engine that supports helpers, filters, partials, and template inheritance. 4KB minzipped, written in TypeScript βΊ