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

Best practices for handling multiple layouts in linemanjs #311

Closed swapneshk closed 9 years ago

swapneshk commented 9 years ago

In my previous MEAN apps if I need to change the layout(In Angular world changing layout means changing the whole page, with different templates in it) I will do things like -

// Different Login Page(layout)
app.get('/login', function(req, res){
  res.render('/pages/login');
});

// Different Dashboard Page(layout)
app.get('/dashboard', function(req, res){
  res.render('/pages/dashboard');
});

It means I have different route set in these layout and they will handle the routes accordingly.

Now in LIneman we have one index.jade in Pages folder under app and all templates are getting into this. So my question is that is the above mentioned scenario of handling multiple layouts, do I need to do the save thing i.e put this kind off code in my server.js file which is in config folder OR there is any lineman way of handling multiple layouts in a better way ?

searls commented 9 years ago

Sorry for the delay in getting back to you.

We currently don't have any support for multiple layouts, in this sense. All of your templates are being compiled down to JavaScript functions and concatenated along with the rest of the app-wide JavaScript bundle, so there's no way you could separate the templates without building a second JavaScript bundle. It's a feature we've discussed in the past but have never prioritized b/c of the number of organizational concerns it raises.

If you'd like to contribute, that issue is #165