2019-10-15 21:30:56 +02:00
|
|
|
const fs = require('fs');
|
2020-02-08 23:26:57 +01:00
|
|
|
const path = require('path');
|
2020-03-02 23:15:44 +01:00
|
|
|
const handlebars = require('handlebars');
|
2020-04-10 05:02:19 +02:00
|
|
|
const packageJson = require('../package');
|
2019-10-15 21:30:56 +02:00
|
|
|
|
2021-07-25 20:38:51 +02:00
|
|
|
/**
|
|
|
|
* @returns {string}
|
|
|
|
*/
|
2020-07-25 22:30:00 +02:00
|
|
|
function compile() {
|
2019-10-15 21:30:56 +02:00
|
|
|
const templatePath = path.resolve(__dirname, 'index.html.handlebars');
|
|
|
|
const template = fs.readFileSync(templatePath).toString();
|
2019-12-10 23:36:34 +01:00
|
|
|
const delegate = handlebars.compile(template);
|
2020-07-25 22:30:00 +02:00
|
|
|
const data = {
|
|
|
|
appTitle: packageJson.productName,
|
|
|
|
};
|
2019-10-15 21:30:56 +02:00
|
|
|
|
2020-07-25 22:30:00 +02:00
|
|
|
return delegate(data);
|
2019-10-15 21:30:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
exports.compile = compile;
|