mirror of
https://github.com/matt-fidd/stratos.git
synced 2026-01-01 22:39:26 +00:00
Added handlebars equality helper
This commit is contained in:
4
app.js
4
app.js
@@ -12,6 +12,7 @@ const serveStatic = require('serve-static');
|
||||
|
||||
// Import user defined modules
|
||||
const DatabaseConnectionPool = require('./lib/DatabaseConnectionPool');
|
||||
const hbsHelpers = require('./lib/handlebarsHelpers.js');
|
||||
const importJSON = require('./lib/importJSON');
|
||||
|
||||
|
||||
@@ -53,7 +54,8 @@ async function main() {
|
||||
app.engine(
|
||||
'hbs',
|
||||
engine({
|
||||
extname: '.hbs'
|
||||
extname: '.hbs',
|
||||
helpers: hbsHelpers
|
||||
})
|
||||
);
|
||||
app.set('view engine', 'hbs');
|
||||
|
||||
6
lib/handlebarsHelpers.js
Normal file
6
lib/handlebarsHelpers.js
Normal file
@@ -0,0 +1,6 @@
|
||||
const helpers = {};
|
||||
|
||||
helpers.eq = (arg1, arg2, options) =>
|
||||
arg1 == arg2 ? options.fn(this) : options.inverse(this);
|
||||
|
||||
module.exports = helpers;
|
||||
Reference in New Issue
Block a user