Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Partials support for Eco templates.

branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

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

Something went wrong with that request. Please try again.