vtree-kup provides CoffeeKup-like DSL for building virtual-dom tree.
$ npm install vtree-kup
vtreeKup = require 'vtree-kup'
render = (counter) -> vtreeKup (k) ->
k.h1 'Counter'
k.p counter.value
k.button { onclick: -> counter.increment() }, 'Increment'
A string is used to specify classes and an id for the element if it is the first argument and valid as a selector.
k.h1 '.title#counter-title', 'Counter'
k.div 'This is an', (-> k.span '.is-important' 'important'), 'element'
k.h1 'Counter'
# #$add accepts both an array and a node
k.$add new VNode('p', {}, [new VText(String(counter.value))])
k.button { onclick: -> counter.increment() }, 'Increment'
- Add new tags (for custom elements)
- Namespace support (SVG, MathML)
- Browser tests