21 lines
492 B
JavaScript
21 lines
492 B
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
const handlebars = require('handlebars');
|
|
const packageJson = require('../package');
|
|
|
|
/**
|
|
* @returns {string}
|
|
*/
|
|
function compile() {
|
|
const templatePath = path.resolve(__dirname, 'index.html.handlebars');
|
|
const template = fs.readFileSync(templatePath).toString();
|
|
const delegate = handlebars.compile(template);
|
|
const data = {
|
|
appTitle: packageJson.productName,
|
|
};
|
|
|
|
return delegate(data);
|
|
}
|
|
|
|
exports.compile = compile;
|