const handlebars = require("handlebars"); const { readFileSync } = require("fs"); const path = require("path"); const CACHE = {}; function get_template(name, dev) { if (!dev && CACHE[name]) return CACHE[name]; const template = handlebars.compile( readFileSync(path.join(__dirname, `./out/${name}/${name}.html`), "utf8") ); CACHE[name] = template; return template; } exports.register = (dev) => get_template("register", dev); exports.admin = (dev) => get_template("admin", dev); exports.authorize = (dev) => get_template("authorize", dev);