a HMLT/CSS generator in CoffeeScript

npm install lilyturf
8 downloads in the last week
17 downloads in the last month

Lilyturf is a simple template engine for CoffeeScript


You can install Lilyturf with NPM:

npm install lilyturf


Its syntax looks like:

{html} = require './lilyturf'
{tidy} = require 'htmltidy'

data =
  lily: 'flower'
  lilyturf: 'plant'

page = html ->
  @div class: 'demo',
    @div id: 'demo',
      for name, type of data
        @div class: 'content',
          @text "#{name}: #{type}"
    if data.others?
      @div class: 'more', (@text data.others)

tidy page, indent: yes, (err, new_page) ->
  console.log new_page

In .html(), @ contains tag names as methods.


I hate crazy brackets, I hate enormous closing tags. Let it be simple to template HTML in CoffeeScript! JS is invented to handle web pages, why is templating so ugly in JS?!

Early prototype on Gist: After a long time, I found it was almost what I was looking for. Then I rewrite it and name it lilyturf.

Referece and Thanks

Browserify and Coffeeify are great tools!



npm loves you