coffee-dsl
CoffeeScript DSL View Engine
Last updated 8 years ago by camshaft .
BSD · Repository · Original npm · Tarball · package.json
$ cnpm install coffee-dsl 
SYNC missed versions from official npm registry.

CoffeeScript DSL View Engine Build Status

Want to make an awesome view engine in CoffeeScript? Try this:

# my-dsl.coffee
cdsl = require "coffee-dsl"
myDSL = cdsl.dsl()

myDSL.set "root", (fun)->
  fun.call
    hello: (value)->
      "Hello #{value}"

module.exports = myDSL
# my-view.coffee

@root ->
  @hello "World"
# main.coffee
myDSL = require "my-dsl"

myDSL.renderFile "my-view.coffee", (error, result)->
  console.log result

This will render Hello World.

The real power comes when we want to build complex objects in a simple way. Look at cscj for an example.

Testing

npm install -d
npm test

Current Tags

  • 0.0.1                                ...           latest (8 years ago)

2 Versions

  • 0.0.1                                ...           8 years ago
  • 0.0.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 1
Last Month 2
Dependencies (1)
Dev Dependencies (2)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |