Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
CoffeeScript DSL View Engine
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
README.md
index.js
package.json

README.md

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
Something went wrong with that request. Please try again.