Wjst

A Node.js and Browser-based JavaScript Template Engine

Wjst

A simple, powerful, and extendable JavaScript Template Engine.


Super Quick Start

For a more in-depth intro, check out the Getting Started docs.

Install Wjst

npm install wjst --save

Create Your Template

<h1>{{ pagename|title }}</h1>
<ul>
{% for author in authors %}
  <li{% if loop.first %} class="first"{% endif %}>
    {{ author }}
  </li>
{% endfor %}
</ul>

Render Your Template

const wjst  = require('wjst');
wjst.renderFile('/path/to/template.html', {
    pagename: 'awesome people',
    authors: ['Den', 'Paul', 'Jane']
});

The End Result

<h1>Awesome People</h1>
<ul>
  <li class="first">Den</li>
  <li>Paul</li>
  <li>Jane</li>
</ul>

Features

  • Available for node.js and major web browsers!
  • Uses similar methodologies as Django, Jinja2, and Twig template engines.
  • Express compatible.
  • Object-Oriented template inheritance.
  • Apply filters and transformations to output in your templates.
  • Automatically escapes all output for safe HTML rendering.
  • Lots of iteration and conditionals supported.
  • Robust without the bloat.
  • Extendable and customizable.
  • Great code coverage.

Resources