jarg
JavaScript template engine powered by arrays, inspired by Clojure.
Target languages
HTML
Using
const html = html const template = 'tagName' optionalObjectWithAttributes anotherTagsOrJustText // => HTML string
Examples
'div' class: 'messages' 'p' 'Some message' 'p' 'Other message' 'Just text'
will rendered into
Some message Other message Just text
With jarg.html conditional rendering becomes a trivial thing:
const greetingComponent = 'div' 'Hello ' name || 'stranger' '!' // => <div>Hello jarg!</div>
And you can use some components inside others, by dividing your application into many independent parts:
const todos = 'Program something' 'Eat' 'Kill spiders' const todoList = 'ul' ...todos const todoApp = 'div' 'h3' 'TODO' 'form' action: 'someUrl' 'label' 'What needs to be done?' 'input' 'button' 'Add'
Comments and restrictions
Each template should have only one root tag.