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

Simple and powerful template engine that supports helpers, partials, filters, native code, and Express.

  • 7.8.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Squirrel

squirrelly

Build Status Codacy BadgeJavaScript Style Guide Join the chat at https://gitter.im/squirrellyjs/Lobby Tip me at paypal.me/bengublerAll Contributors

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.

Notice: Squirrelly Version 8 is coming out soon! Learn More

Why Squirrelly?

Features:

  • Custom helpers
  • Custom filters
  • Conditionals
  • Loops
  • Custom delimeters
  • Precompilation
  • Partials
  • Writing JavaScript inside the template
  • Comments
  • Caching
  • Just 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: {{favoriteCake}}</p>"
​
Sqrl.Render(myTemplate, {favoriteCake: 'Chocolate!'})
// Returns: '<p>My favorite kind of cake is: Chocolate!</p>

Conditionals

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

Loops

{{each(options.somearray)}}
Display this
The current array element is {{@this}}
The current index is {{@index}}
{{/each}}

Tests

The default test can be run with npm test, and it just checks that compiling and rendering a simple template results in the correct string.

Contributing

We love contributions from the community! Contributions are accepted using GitHub pull requests; for more information, see GitHub documentation - Creating a pull request.

For a good pull request, we ask you provide the following:

  1. Include a clear description of your pull request in the description with the basic "what" and "why" for the request.
  2. The test should pass.
  3. The pull request should include tests for the change. A new feature should have tests for the new feature and bug fixes should include a test that fails without the corresponding code change and passes after they are applied.
  4. If the pull request is a new feature, please include appropriate documentation in the README.md file as well.
  5. Keep a consistent coding style.

Contributors

Ben Gubler
Ben Gubler

💻 💬 📖 ⚠️
Mark Evans
Mark Evans

💻
donpedro
donpedro

💬

This project exists thanks to all the people who contribute. We welcome contributions! Learn how to contribute here.

Version 8

Some of you may have been wondering about the lack of activity on this repository over the last few months. The answer is that, for quite a while, I've been working on a brand-new version of Squirrelly. You can read about it on GitHub, but here's a quick overview:

Low-Level Changes

  • New, more reliable parser -- see a draft here
  • AST generation before compiled-function generation
  • Partials will be referenced instead of inlined
  • Bundling with Rollup for smaller code size

New Features

  • Layouts
  • Async support
  • Helpers will be prefixed with ~, so {{~if(options.stuff}}
  • 'Interpolate syntax': {{=4+3}}
  • Native Code: what was previously {{js(var x = 0)/}} will become: {{!var x = 0}}
  • Filter parameters, ex. {{somearray | join(",") }}
  • Save the cache and load it later
  • Plugins

Bug Fixes

  • Filter chaining will work once more (this was fixed in 7.5.0)

License

Squirrelly is licensed under the MIT license.

Keywords

FAQs

Package last updated on 13 Nov 2019

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