Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple layouts and view directories? #60

Closed
michaelBenin opened this issue Mar 3, 2014 · 10 comments
Closed

Multiple layouts and view directories? #60

michaelBenin opened this issue Mar 3, 2014 · 10 comments

Comments

@michaelBenin
Copy link

Used with this patch:
http://stackoverflow.com/questions/11315351/multiple-view-paths-on-node-js-express

@michaelBenin
Copy link
Author

Never mind I see you can specify the layout in locals.

@michaelBenin
Copy link
Author

Is it possibly to have multiple view directories?

@defunctzombie
Copy link
Collaborator

This is not a support form. Please ask on stackoverflow.

@michaelBenin
Copy link
Author

I reopened this because I first found the question asked on StackOverflow and the solution breaks with hbs.

http://stackoverflow.com/questions/11315351/multiple-view-paths-on-node-js-express (second one with require)

TypeError: Arguments to path.join must be strings
at path.js:360:15
at Array.filter (native)
at Object.exports.join (path.js:358:36)
at middleware (/Users/Adminstrator/Desktop/node-startup/node_modules/hbs/lib/hbs.js:105:30)
at View.render (/Users/Adminstrator/Desktop/node-startup/node_modules/express/lib/view.js:76:8)
at Function.app.render (/Users/Adminstrator/Desktop/node-startup/node_modules/express/lib/application.js:504:10)
at ServerResponse.res.render (/Users/Adminstrator/Desktop/node-startup/node_modules/express/lib/response.js:798:7)

@michaelBenin
Copy link
Author

I think specifying multiple view directories is a win. If you can do that with hbs great I think that there's an issue in the documentation on how to do this. If not it's a feature I think is needed. I'm sorry if this came off as a support issue, please consider reopening this.

@defunctzombie
Copy link
Collaborator

Express supports only one view directory, we will not support specifying multiple.

@michaelBenin
Copy link
Author

Also I don't know if you remember but we had a beer together in Houston Hall a couple months ago, you recommended taters.

@defunctzombie
Copy link
Collaborator

I remember :) (now that you mention it, otherwise wouldn't have recognized the name)

@michaelBenin
Copy link
Author

So I did some research on this issue: expressjs/express#533

For a large project I'm working on I'd like to organize my (page) templates in different folders, but spinning up a new app to make this happen is not worth it. For now it's fine that all my page templates are in one folder, but I really would like to break out the test templates. Before I started working with Express and Node I worked with Django and really liked how we had this ability to organize our templates.

@defunctzombie
Copy link
Collaborator

you can put them in multiple folders and just res.render('folder/file') it will work just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants