Multiple view directories.
See original GitHub issueSince version 2.0.0
you can no longer use multiple view directories:
With the following code:
server.set('view engine', '.hbs');
server.set('views', [
dirPath1,
dirPath2,
dirPath3
]);
I get:
TypeError: Arguments to path.resolve must be strings
This was ok in version 1.1.0
, and it appears as though this should be supported when looking at the Express documentation (http://expressjs.com/api.html).
From option views
:
A directory or an array of directories for the application’s views. If an array, the views are looked up in the order they occur in the array.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:9
Top Results From Across the Web
multiple views directories for one expressjs app
I have defined by views folder structure to be \views\{model}\{operations} . For example: \views\products\add.ejs . When I reference the view in ...
Read more >Combined view of multiple directories in Linux
Samba is configured to share all three disk (3 separate shares). Disks contain folders an each of them has folderA and folderB containing...
Read more >Multiple views directories with express-hbs - derp turkey
This article talks about how you can put views in multiple locations and still use Express 4's default view rendering pipeline.
Read more >Search multiple directories and output file names
This will list all the content of the 7 directory if they are in the same location. Share.
Read more >Managing Multiple Directories
See centralized user management. Overview. Here is a summary of how the directory order affects the processing: The order of the directories is ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
When I try to set two folders in the
app.set('views', ['views1', 'views2'])
, I get the error:But it works well either by
app.set('views', 'views1')
orapp.set('views', 'views2')
.After read this issue, I’m puzzled whether have I understand it. But it seems still a lot people suffer from this such as this issue.
I’m trying to find a solution, but it doesn’t look well.
Not a great long-term solution, but if all your handlebars views are in a single folder, here’s a temporary solution.
This works because it fixes this line, which breaks when you set views to be an array.