aboutsummaryrefslogtreecommitdiff
path: root/src/templates.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/templates.js')
-rw-r--r--src/templates.js23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/templates.js b/src/templates.js
index 2c02905..6e3b541 100644
--- a/src/templates.js
+++ b/src/templates.js
@@ -2,21 +2,20 @@ const fs = require('fs');
const path = require('path');
const handlebars = require("handlebars");
+function loadTemplate(templates, name, filepath){
+ const templateContent = fs.readFileSync(filepath).toString()
+ templates[name] = handlebars.compile(templateContent);
+}
+
function setUpTemplates(){
let templates = {};
- {
- const templateContent = fs.readFileSync(path.join(__dirname, 'templates/login.html')).toString()
- templates["login"] = handlebars.compile(templateContent);
- }
- {
- const templateContent = fs.readFileSync(path.join(__dirname, 'templates/index.html')).toString()
- // templates["index"] = handlebars.compile(templateContent);
- }
- {
- const templateContent = fs.readFileSync(path.join(__dirname, 'templates/summary.html')).toString()
- templates["summary"] = handlebars.compile(templateContent);
- }
+ loadTemplate(templates, "index", path.join(__dirname, 'templates/index.html'))
+ loadTemplate(templates, "login", path.join(__dirname, 'templates/login.html'))
+ loadTemplate(templates, "ledger", path.join(__dirname, 'templates/ledger.html'))
+ loadTemplate(templates, "goals", path.join(__dirname, 'templates/goals.html'))
+ loadTemplate(templates, "expected", path.join(__dirname, 'templates/expected.html'))
+ loadTemplate(templates, "summary", path.join(__dirname, 'templates/summary.html'))
return templates
}