configuration `layoutsDir` & `partialsDir` is invalid
See original GitHub issueAfter 3.0.1 was released, the configuration options layoutsDir
and partialsDir
became invalid.
utils.assign(this, {
handlebars : Handlebars,
extname : '.handlebars',
layoutsDir : 'views/layouts/',
partialsDir : 'views/partials/',
defaultLayout : undefined,
helpers : undefined,
compilerOptions: undefined,
}, config);
Because after Fixes #147, the custom configuration options layoutsDir
and partialsDir
will be overridden.
var viewsPath = options.settings && options.settings.views;
if (viewsPath) {
view = this._getTemplateName(path.relative(viewsPath, viewPath));
this.partialsDir = path.join(viewsPath, 'partials/');
this.layoutsDir = path.join(viewsPath, 'layouts/');
}
I hope it can be repaired as soon as possible.Thank you.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:6
Top Results From Across the Web
A partials dir must be a string or config object in handlebars ...
I had to add the partialsDir to my handlebarOptions where I didn't have the field before: const handlebarOptions = { viewEngine: { extName: ......
Read more >express-handlebars - npm
layoutsDir. Default layouts directory is relative to express settings.view + layouts/ The string path to the directory where the layout ...
Read more >A partials dir must be a string or config object in handlebars ...
Coding example for the question Error: A partials dir must be a string or config object in handlebars-node.js.
Read more >A Step By Step Guide To Using Handlebars With Your Node js ...
Setting Up A Basic Express Server. Let's start by creating a folder which will contain our app and within it type the following...
Read more >WEB322 Week 6 Notes
sendFile(path.join(__dirname, "/week2-assets/about.html")); }); // setup ... of Express Handlebars require the layout to be explicitly set to “false” if not ...
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
Yeah, I also found it. It is needed when developer not defined the
layoutsDir
andpartialsDir
as given default config path here is relative https://github.com/ericf/express-handlebars/blob/5d27bb50ba299d7ba185dfc5b9f8057bf7129256/lib/express-handlebars.js#L24-L32so I think maybe change like this is fine for global custom one or default one
and
I changed on my local like this and it work fine with my old settings
Thank you for reporting the issue. The bug has been fixed and the new version v3.0.2 is now published on npm.