init
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
const path = require('path');
|
||||
const hbs = require(path.resolve('node_modules', 'hbs'));
|
||||
|
||||
const registerPartialsWithExtensions = require('./utils/registerPartialsWithExtensions');
|
||||
|
||||
function toJSON (obj) {
|
||||
if (typeof obj === 'object') {
|
||||
return JSON.stringify(obj)
|
||||
}
|
||||
return obj
|
||||
}
|
||||
|
||||
module.exports.applyHbs = (app) => {
|
||||
const templates = path.resolve(__dirname, 'templates')
|
||||
registerPartialsWithExtensions(hbs, templates)
|
||||
hbs.registerHelper('toJSON', toJSON)
|
||||
app.engine('hbs', hbs.__express)
|
||||
app.set('views', templates)
|
||||
}
|
||||
Reference in New Issue
Block a user