Permalink
Browse files

revised coffeekup example due to latest coffeekup improvements

  • Loading branch information...
1 parent 204d9b1 commit 22bbfef4f027ad430cca37831e762be6bdbe0d9a @kadirpekel committed Jun 20, 2011
@@ -5,14 +5,10 @@ mate = require '../../lib/coffeemate'
mate.options.renderExt = '.coffeekup'
mate.options.renderDir = 'views'
-# bind coffeekup explicitly
-mate.options.renderFunc = (tmpl, ctx) ->
- coffeekup.render tmpl, context: ctx
-# or use the shortcut sugar below
-# mate.coffeekup()
+# Bind coffeekup with an helper
-mate.context.highlight = (msg) ->
- "<span style=\"background-color:#ff0\">#{msg}</span>"
+mate.coffeekup highlight: (color, msg) ->
+ text "<span style=\"background-color:#{color}\">#{msg}</span>"
mate.get '/', ->
@foo = 'bar'
@@ -1,5 +1,7 @@
html ->
head
body ->
- h1 "Kup of coffee"
- div @highlight @foo
+ h1 "A cup of coffee demonstration"
+ include "nested1"
+ include "nested2"
+ include "nested3"
@@ -0,0 +1,2 @@
+p ->
+ highlight "#0ff", "This is a highlighted text"
@@ -0,0 +1,2 @@
+p ->
+ highlight "#f00", "This is a highlighted text"
@@ -0,0 +1,2 @@
+p ->
+ highlight "#ff0", "This is a highlighted text"

0 comments on commit 22bbfef

Please sign in to comment.