Skip to content

Latest commit

 

History

History
81 lines (56 loc) · 1.22 KB

README.md

File metadata and controls

81 lines (56 loc) · 1.22 KB

vk

Virtual DOM Template for CoffeeScript

Easy Virtual DOM Wrapper Inspired by mauricemach/coffeekup

bower install mizchi/vk

Examples

Basic usage

React.createClass
  render: -> vk ($) ->
    $.h1 'Hello'
    $.ul className: 'foobar-container', ->
      $.li "foo"
      $.li "bar"

vk generate Virtual DOM

Child component

Greeting = React.createClass
  render: -> vk ($) ->
    	$.h1 "Hello"

Item = React.createClass
  render: ->
    {title} = @props
    vk {tag: 'li'}, ($) -> span title

React.createClass
  render: -> vk ($) ->
    $(Greeting)
    $.ul ->
      for i in [1..4]
        $(Item, title: "item:"+i)

API

vk

  • vk.render(block: Function)
  • vk.render(opts: Object, block: Function)

vk.render opts argument is for first element.

React.createClass
	render: -> vk tag: 'ul', className: 'foo', ($) ->
		$.li "foo"
		$.li "bar"

DOM

  • d.<tagName>(opts: Object, block: Function)
  • d.<tagName>(opts: Object, str: String)
  • d.<tagName>(block: Function)
  • d.<tagName>(string: String)
  • d.<tagName>(opts: Object)

TODO

  • tests

Dependencies

  • React

LICENSE

MIT