Skip to content

Instantly share code, notes, and snippets.

@diosmosis
Created February 19, 2012 10:51
Show Gist options
  • Save diosmosis/1863137 to your computer and use it in GitHub Desktop.
Save diosmosis/1863137 to your computer and use it in GitHub Desktop.
jsquickhtml examples
# load jsquickhtml as a module if on node.js,
# or assume its been loaded if in the browser
if require?
jsq = require 'jsquickhtml'
else
jsq = window.jsq
# define some elements
div = jsq.lazy_element 'div'
# define a template
ShowPost = (post) ->
div(class: 'post', [
div(class: 'post-title', [
span(post.title)
])
, div(post.body, class: 'post-body')
])
# a post obtained from somewhere
post = ...
# render the template
jsq.render_to(ShowPost(post), $('body'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment