Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

squirrelly

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

squirrelly

Lightweight, fast, and powerful JS template engine. Supports helpers, filters, template inheritance

  • 8.0.0-beta.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
20K
decreased by-13.92%
Maintainers
1
Weekly downloads
 
Created
Source

Squirrel

squirrelly

GitHub package.json version (master) Travis All Contributors Coveralls Dev Dependencies

styled with prettier Greenkeeper badge Join the chat at https://gitter.im/squirrellyjs/Lobby 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 ~3.3KB 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.

Version 8 is still in beta. Squirrelly v7 will continue to be maintained, and can be found at https://github.com/squirrellyjs/squirrelly/tree/v7. Since the API of v8 isn't fully documented yet, most people should probably use v7 for the next few weeks.

Read about the changes

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
  • 🚀 Fast
  • ⚡️ 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]

Contributors

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


Ben Gubler

💻 💬 📖 ⚠️

Clite Tailor

🤔 💻

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 a Squirrelly Error.

Keywords

FAQs

Package last updated on 24 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc