Kup. A simplified CoffeeKup (github.com/mauricemach/coffeekup) implementation
CoffeeScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
kup.coffee

README.md

Kup

Kup. A small all-coffee template language where elements are described with css-like syntax

Example:

template = Kup ->
  _ '.field', ->
    _ '.placeholder', 'Description'
    _ '.focused' if @focused
    _ 'textarea.field', { readonly: not @editable }, @val

produces the same output (but does not compile to)

template = (context) -> (->
  '<div class="field">'+
    '<div class="placeholder">Description</div>'+
    (if @focused then '<div class="focused"></div>' else '')+
    '<textarea class="field"'+(if not @editable then ' readonly' else '')+'>'+@val+'</textarea>'+
  '</div>'
  ).call(context)

To render a template you just call the function with a context object:

template(val: "Some Description", editable: true, focused: false)

Based on: