Note that there are some explanatory texts on larger screens.

plurals
  1. POExpress not finding/using layout
    primarykey
    data
    text
    <p>I am trying to use express and render a layout.jade my directory tree is pretty standard.</p> <pre><code>├── apps │   └── fridge_face │   ├── routes.coffee │   └── views | └── index.jade ├── server.js └── views ├── layout.jade └── stylesheets └── style.styl </code></pre> <p>In my routes.coffee when I render index.jade everything words fine, but layout is not rendered. I have tried moving layout into <code>apps/fridge_face/views/</code> but that was not successful.</p> <p>I have done no layout configuration.</p> <p>Here is my </p> <h3>layout.jade</h3> <pre><code>doctype 5 html head title 'What is up' link(rel='stylesheet', href='/stylesheets/style.css') body != body </code></pre> <h3>routes.coffee</h3> <pre><code>routes = (app) -&gt; app.get '/', (req, res) -&gt; Word.once 'wordsFetched', (params) -&gt; res.render "#{__dirname}/views/index", layout: true words: params.map (word) -&gt; word.word Word.getWords() module.exports = routes </code></pre> <h3>server.js config</h3> <pre><code>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')); }); </code></pre> <p>As you can see nothing that could or would make the layout not render... what am I doing wrong how do I get express to find my layout</p> <h2>Edit</h2> <hr> <p>I know I am making this question super long but adding some developments. First</p> <p>When I remove the <code>!=</code> from the layouts in both directories, nothing changes. My view is still rendered layout free.</p> <p>When I add </p> <pre><code>app.set('view options', { layout: false }); </code></pre> <p>and then explicitly render my layout in my view with either</p> <pre><code>layout: "#{__dirname}/views/layout" # OR layout: "layout" # OR layout: true </code></pre> <p>Nothing happens and the view is rendered layout free...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload