diff --git a/README.md b/README.md index df88b2a..7284695 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ mate.context.highlight = (color, txt) -> mate.get '/greet/:name', -> # this is context variable @greet_msg = "Hello, #{@req.params.name}" - @render 'home.eco' + @render 'home' # Stream it mate.io.sockets.on 'connection', (socket) -> @@ -42,6 +42,17 @@ mate.io.sockets.on 'connection', (socket) -> mate.listen 3000 ``` +``` html + + +
+ + + <%- @include @body %> + + +``` + ``` html diff --git a/examples/coffeekup/views/layout.coffeekup b/examples/coffeekup/views/layout.coffeekup new file mode 100644 index 0000000..b09c5a9 --- /dev/null +++ b/examples/coffeekup/views/layout.coffeekup @@ -0,0 +1,4 @@ +html -> + head + body -> + include @body \ No newline at end of file diff --git a/examples/coffeekup/views/main.coffeekup b/examples/coffeekup/views/main.coffeekup index 616a7ff..383bd23 100644 --- a/examples/coffeekup/views/main.coffeekup +++ b/examples/coffeekup/views/main.coffeekup @@ -1,10 +1,7 @@ -html -> - head - body -> - h1 "A cup of coffee demonstration" - div -> - include "nested1" - div -> - include "nested2" - div -> - include "nested3" \ No newline at end of file +h1 "A cup of coffee demonstration" +div -> + include "nested1" +div -> + include "nested2" +div -> + include "nested3" \ No newline at end of file diff --git a/examples/connect/app.coffee b/examples/connect/app.coffee index 801ce78..07a8d39 100644 --- a/examples/connect/app.coffee +++ b/examples/connect/app.coffee @@ -4,6 +4,6 @@ mate.logger() mate.static(__dirname + '/public') mate.get '/', -> - @render 'main.eco' + @render 'main' mate.listen 3000 diff --git a/examples/connect/layout.eco b/examples/connect/layout.eco new file mode 100644 index 0000000..68571b5 --- /dev/null +++ b/examples/connect/layout.eco @@ -0,0 +1,7 @@ + + + + + <%- @include @body %> + + diff --git a/examples/helpers/app.coffee b/examples/helpers/app.coffee index d0222f1..5bdb3a2 100644 --- a/examples/helpers/app.coffee +++ b/examples/helpers/app.coffee @@ -4,6 +4,6 @@ mate.context.highlight = (msg) -> "#{msg}" mate.get '/', -> - @render 'main.eco' + @render 'main' mate.listen 3000 diff --git a/examples/helpers/layout.eco b/examples/helpers/layout.eco new file mode 100644 index 0000000..68571b5 --- /dev/null +++ b/examples/helpers/layout.eco @@ -0,0 +1,7 @@ + + + + + <%- @include @body %> + + diff --git a/examples/layout/app.coffee b/examples/layout/app.coffee index b02af3e..3a6dc91 100644 --- a/examples/layout/app.coffee +++ b/examples/layout/app.coffee @@ -1,12 +1,7 @@ mate = require '../../lib/coffeemate' -# build your own layout structure -mate.context.custom_render = (template_name) -> - @content = template_name - @render 'layout.eco' - mate.get '/', -> @foo = 'bar' - @custom_render 'main.eco' + @render 'main' mate.listen 3000 diff --git a/examples/layout/layout.eco b/examples/layout/layout.eco index 0cedd59..52c752e 100644 --- a/examples/layout/layout.eco +++ b/examples/layout/layout.eco @@ -2,7 +2,7 @@