Open r-h36 opened 5 years ago
Are you sure this isn't a case sensitive issue:
just want to throw in here that the handlebars engine wasn't recognizing partials with .hbs
until I specified it in the value passed to app.engine
, even though templates were recognized just fine.
I passed in {extname: 'hbs'}
to the engine factory function and it started picking up partials with an .hbs
extension. This worked for me with and without a leading dot, i.e. using hbs
and .hbs
as the value for extname
worked the same.
const express = require('express');
const hbs = require('express-handlebars');
const app = express();
// app.engine('hbs', hbs());
app.engine('hbs', hbs({ extname: 'hbs' ));
app.set('view engine', 'hbs');
const express = require('express'); const exphbs = require('express-handlebars'); const path = require('path'); const router = require('./routes');
const app = express();
// habilitar handlebarss como view
app.engine('.hbs', exphbs.engine({ defaultLayout: 'layout' }) );
Env settings:
Just updated the express-handlebars from 3.0.0 to 3.1.0 run into this issue: server.js
The extName is defined in the config.
in test.hbs
File structure
This results in error
Error: The partial pages/nav could not be found
But if I change the
nav.hbs
tonav.handlebars
, the error is gone.nav.hbs used to be working fine before I update the express-handlebars to 3.1.0