Partials support for Eco templates.
Latest commit af8fbbe Feb 20, 2013 Alex Kravets Merge pull request #2 from kunev/support_eco_extension
Support eco extension

Eco-plus is Eco extension for Express

which adds include, parent and block tags. These special tags allow to split templates into several files in the same way Django or Liquid does it.



        <% block "title" %>**Parent Title**<% endblock %>
        <% block "main" %>Parent Content<% endblock %>


<% parent "layout" %>
<% block "title" %><%= block.super %> | Page Title<% endblock %>
<% block "main" %>
  <% include "header" %>
  Page Content
  <% include "footer" %>
<% endblock %>


Add "eco-plus": ">=0.1.2" to package.json dependencies and run npm install:

  "dependencies": {
    "eco-plus": ">=0.1.2"

Express Integration

To integrate Eco-plus into express default render method should be overrided. Add these somewhere in express configuration section:

# Setting up and configuring eco-plus to render templates
# We also override default express/http render method
ecoplus = require 'eco-plus'

templates_path  = "<path to application templates>"
app.templates   = ecoplus.templates(templates_path)
res             = require('http').ServerResponse.prototype

res.render = (name, context={}) ->
    html = ecoplus.render(name, context, app.templates)


You're welcome to submit any issues or feature requests.

License (MIT)

Alex Kravets