Andreas Selenwall
Andreas Selenwall

Reputation: 5785

EJS layouts on Express 3

I am having some problem with the EJS layout file on Express 3. Express just can't seem to find the layout for rendering. It just skips the layout.ejs totally which means that the output misses out of all the stylesheets and such.

res.render('login', { user: req.user });

and the configuration part,

app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');

and in the layout.ejs I have added the body tag,

<%- body %>

I have been trying out Jade before and it worked just fine, so the problem is just EJS.

Thanks in advance.

Upvotes: 6

Views: 6021

Answers (1)

Michael
Michael

Reputation: 434

https://github.com/visionmedia/ejs/issues/48

I am uncertain whether the above has been updated but it suggests that layout functionality has been deprecated in express 3.

As a result, I have been using ejs-locals to implement equivalent functionality:

https://github.com/RandomEtc/ejs-locals

Upvotes: 11

Related Questions