Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

remove `.ect` suffix when call `res.render()` or in template `include` and `extend` #54

Merged
merged 3 commits into from

4 participants

@Treri

when set view engine to ect, and engine app with ectRenderer.render.
we can remove the .ect suffix when call res.render(), just like using default view engine ejs and jade.
and remove .ect suffix in template include and extend

@nguyenning

This is a great PR.

@baryshev baryshev merged commit b378bdf into baryshev:master
@baryshev
Owner

Thank you for PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 4 deletions.
  1. +11 −4 README.md
View
15 README.md
@@ -67,12 +67,13 @@ app.js
var express = require('express');
var app = express();
var ECT = require('ect');
-var ectRenderer = ECT({ watch: true, root: __dirname + '/views' });
+var ectRenderer = ECT({ watch: true, root: __dirname + '/views', ext : '.ect' });
-app.engine('.ect', ectRenderer.render);
+app.set('view engine', 'ect');
+app.engine('ect', ectRenderer.render);
app.get('/', function (req, res){
- res.render('index.ect');
+ res.render('index');
});
app.listen(3000);
@@ -81,10 +82,16 @@ console.log('Listening on port 3000');
views/index.ect
```html
-<% extend 'layout.ect' %>
+<% extend 'layout' %>
+<% include 'extra' %>
<div>Hello, World!</div>
```
+views/extra.ect
+```html
+<div>Include me!</div>
+```
+
views/layout.ect
```html
<html>
Something went wrong with that request. Please try again.