celery/handlers/gemini.js
2022-03-21 09:55:02 -07:00

20 lines
591 B
JavaScript

const fs = require("fs");
const path = require("path");
const mustache = require("mustache");
const gemini = require("../util/gemini.js");
const { version } = require("../modules/03-cache.js");
const template = fs.readFileSync("assets/wrapper.html", "utf8");
exports.hash = (where) => fs.statSync(where).mtime.valueOf();
exports.render = (where) => mustache.render(template, {
body: gemini(fs.readFileSync(where, "utf8")),
title: path.basename(where),
cache: {
style: version("/assets/style.css"),
code: version("/assets/code.css"),
essay: version("/assets/essay.css"),
},
});