Summary
Squirrelly is a modern, configurable, and blazing fast template engine implemented in JavaScript. It works out of the box with ExpressJS and weighs only 2.6KB gzipped.
- Custom helpers
- Custom filters
- Conditionals
- Loops
- Custom delimeters
- Precompilation
- Partials
- Writing JavaScript inside the template
- Comments
- Caching
- Just look at the performance benchmarks here
We know nobody reads through the long and boring documentation in the ReadMe anyway, so head over to the documentation website:
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>
{{if(options.somevalue === 1)}}
Display this
{{#else}}
Display this
{{/if}}
{{each(options.somearray)}}
Display this
The current array element is {{@this}}
The current index is {{@index}}
{{/each}}
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.
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:
- Include a clear description of your pull request in the description with the basic "what" and "why"s for the request.
- The test should pass.
- 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.
- If the pull request is a new feature, please include appropriate documentation in the
README.md
file as well. - Keep a consistent coding style.
This project exists thanks to all the people who contribute. [Contribute].
The top 7:
Squirrelly is licensed under the MIT license.