import * as handlebars from "handlebars"; import { readFileSync } from "fs"; import { __ as i__ } from "i18n"; import config from "../config"; let template: handlebars.TemplateDelegate; function loadStatic() { let html = readFileSync("./views/out/login/login.html").toString(); template = handlebars.compile(html); } /** * Benchmarks (5000, 500 cuncurrent) * Plain: * - dev 10sec * - prod 6sec * Mustache: * - dev : 15sec * - prod: 12sec * * Handlebars: * Compile + Render * - dev 13sec * - prod 9sec * Compile on load + Render * - dev 13sec * - prod 6sec */ export default function GetLoginPage(__: typeof i__): string { if (config.core.dev) { loadStatic(); } let data = {}; return template(data, { helpers: { i18n: __ } }); } loadStatic();