linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 83 forks source link

How to call another layout in linemanjs #296

Closed swapneshk closed 9 years ago

swapneshk commented 9 years ago

For one of my route I am trying to call another layout but it is throwing errors.

Example code in server.js under config folder -

app.get('/dashboard', function(req, res){
  res.render('dashboard-layout');
});

My "dashboard-layout.jade" is residing under app/pages folder.

Following Error I am getting when visiting the URL -

Error: Cannot find module 'jade'

I tried by setting an option app.set('view engine', 'jade'); but no work like -

app.get('/dashboard', function(req, res){
  app.set('view engine', 'jade');
  res.render('dashboard-layout');
});

Though If I am using res.send({"message": "This is working!"});, I am getting the message when hitting the URL.

Let me know what I am doing here.

FYI -

My templates are working if routed via index.jade. Let me know if some more details needed from my side.

swapneshk commented 9 years ago

For future reference -

Its working now the only thing I was doing wrong is not referencing correct path with the file, ie.-

app.set('view engine', 'jade'); res.render('../app/pages/dashboard-layout');

fixed the problem.

Good to close this now.