gulp(hbs):
const handlebars = require('gulp-compile-handlebars');
gulp.task('default', function () {
const options = {
ignorePartials: true,
batch : ['src/views/partials'],
helpers : {
capitals : function(str){
return str.toUpperCase();
}
}
}
return gulp.src('src/views/*.hbs')
.pipe(handlebars(options))
.pipe(gulp.dest('dist/'));
});
server(hbs):
const exphbs = require('express-handlebars');
const homeRoutes = require('./src/routes/home.js');
const app = express();
const hbs = exphbs.create({
defaultLayout: 'main',
extname: 'hbs'
});
app.use('/', homeRoutes);
app.engine('hbs', hbs.engine);
app.set('view engine', 'hbs');
app.set('views', 'views');
Ошибка cannot get /, хотя все должно работать.