I have a regular expressjs express application ...
var express = require('express'); var app = express.createServer( express.bodyParser() ); app.configure( function () { app.set('views', __dirname + '/views'); app.set('view engine', 'ejs'); app.use("/public", express.static(__dirname + '/public')); }); app.get('/', function (req, res) { res.render('index'); });
I have index.ejs and layout.ejs in the / views folder:
layout.ejs:
<!doctype html> <html lang="en" manifest=""><head> <title>jQuery Plugin Demo</title> </head> <body> <div class="container container-fluid"> <%- body %> </div> </body> </html>
index.ejs:
Hello world
index.ejs only displays the text "Hello world" without the surrounding layout.ejs shell. Works ejs. It may find the correct .ejs template, but it just ignores the layout. I also tried to explicitly add the layout file to the application.
app.set('view options', { layout:'layout.ejs' });
All of this works great locally, but not Heroku. Here is my package.json:
{ "name": "in1-test", "version": "0.0.1", "author": "Iatek", "dependencies": { "express": ">=2.5.x", "ejs": ">=0.7.x" }, "engines": { "node": "0.6.x" } }
Why is there no joy on the layout ??? Thanks
source share