Simple template engine for two way bindings

Richard Parker

Simple template engine for two way bindings.

A Tiger? Richard Parker was a Tiger? Yeah! He got his name through a clerical error. A Hunter caught him when drinking from a stream when he was a cub, and named him Thirsty. When Thirsty got too big, the hunter sold him to our zoo, but the names got switched on the paperwork. The hunter was listed as Thirsty and the tiger was called Richard Parker. We laughed about it and the name stuck.

Its kind of Mustache in s-expressions.


{has .tigers
    {each .tigers
      <li x-bind="{path .name}">{.name}</li>


  tigers: [
    {name: 'Richard Parker'}
    {name: 'Thirsty'}


  <li x-bind=".tigers[0].title">Richard Parker</li>
  <li x-bind=".tigers[1].title">Thirsty</li>

The possibility to output the current path is intended to be used for two way data bindings.

Using npm

$ npm install richardparker

Using Component

$ component install richardparker

The package can be consumed as a component or as a npm module. For use on the server and on the client.

Richard Parker can compile templates to common js or optionally to amd modules.

$ richardparker template.html       # compile template.html and output to stdout
$ richardparker -a foo.html         # compile test.html and output as amd module
var richard = require('richardparker'),
    // render directly
    html = richard('{has .title <h1>{.title}</h1>}', {name: 'foo'});
    // compile to javascript function
    template = richard.compile('{has .title <h1>{.title}</h1>}'),

New commands can be added quite easily as compile time marcros. To see how its done checkout the native marcros has, ., each, and path.