Skip to content
This repository has been archived by the owner on Jan 19, 2018. It is now read-only.

mvc-works/coffee-html

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coffee-HTML: generate HTML in CoffeeScript

Usage

You can install Coffee-HTML with NPM:

npm install coffee-html

Its syntax looks like:

{html} = require 'coffee-html'

data =
  rose: '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)

page # => generated HTML here

This package only supports tags that defined in the source code. Customized tags are not supported.

Changelog

  • 0.4.2

    • Refactor code from my early years
    • Remove __proto__
  • 0.4.0

    • Previously named Liliturf, renamed to Coffee-HTML

Early ideas:

A Gist: https://gist.github.com/2498711

License

MIT

About

Write HTML in CoffeeScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published