KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to create a simple server in Node.js which uses Jade templates and layouts. For some reason it will only load the template and not the layout. Here's what I've got: main.js var express = require('express'); var app = express.createServer(); app.set('views', __dirname + '/views'); app.set('view engine','jade'); app.set('view options', { layout: true }); app.get('/', function(req,res) { res.render('index', { title: 'My site' }); }); app.listen(4000); As you can see layouts are enabled. I've tried referencing it directly in the render method but it doesn't make a difference. Worth noting might also be that the "title: 'My site'" doesn't work either. index.jade h2 Hello! p I really hope this is working now lo.jade !!! 5 html head title Why won't this work body h1 I AM A LAYOUT div= body Here's my npm list : ├─┬ express@3.0.0alpha1 │ ├── commander@0.5.2 │ ├─┬ connect@2.1.2 │ │ ├── crc@0.1.0 │ │ ├── formidable@1.0.9 │ │ ├── mime@1.2.4 │ │ └── qs@0.4.2 │ ├── debug@0.6.0 │ ├── mime@1.2.5 │ └── mkdirp@0.3.1 └─┬ jade@0.24.0 ├── commander@0.5.2 └── mkdirp@0.3.0 Any ideas on why this isn't working?
Tags (comma-separated)
Save Edits
Cancel