I am trying to use express and render layout.jade, my directory tree is pretty standard.
├── apps │ └── fridge_face │ ├── routes.coffee │ └── views | └── index.jade ├── server.js └── views ├── layout.jade └── stylesheets └── style.styl
In my routes. Coffee, when I do index.jade all the words are fine, but the layout is not displayed. I tried moving the layout to apps/fridge_face/views/ but it failed.
I did not create a layout configuration.
Here is my
layout.jade
doctype 5 html head title 'What is up' link(rel='stylesheet', href='/stylesheets/style.css') body != body
routes.coffee
routes = (app) -> app.get '/', (req, res) -> Word.once 'wordsFetched', (params) -> res.render "#{__dirname}/views/index", layout: true words: params.map (word) -> word.word Word.getWords() module.exports = routes
server.js config
app.configure(function(){ app.set('port', process.env.PORT || 3000); app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); app.use(express.favicon()); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router); app.use(express['static'](__dirname + '/public')); });
As you can see, nothing that could or could make the layout not display ... what I'm doing wrong, how to get express to find my layout
Edit
I know that I am making this question very long, but adding some changes. First
When I delete != From layouts in both directories, nothing changes. My view is still displayed without a layout.
When i add
app.set('view options', { layout: false });
and then explicitly display my layout in my view with
layout: "#{__dirname}/views/layout"
Nothing happens and the view is rendered without a layout ...