-
Part of my build pipeline includes generating documentation from my existing SSG. It results in files in the static folder. However, how do I convert from |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I figured some things out, see here https://github.com/dnk8n/rethinkcode/tree/integrate-lume It is currently working at https://rethinkcode--integrate-lume.deno.dev/ e.g. https://rethinkcode--integrate-lume.deno.dev/projects/mercede-benz Prettier site to come! The main change happens at routes/_middleware.ts: import { MiddlewareHandlerContext } from "$fresh/server.ts";
interface State {
data: string;
}
export async function handler(
req: Request,
ctx: MiddlewareHandlerContext<State>,
) {
const filePath = "_site" + new URL(req.url).pathname + "/index.html";
let fileSize;
try {
fileSize = (await Deno.stat(filePath)).size;
} catch (e) {
if (e instanceof Deno.errors.NotFound) {
return await ctx.next();
}
return new Response(null, { status: 500 });
}
const body = (await Deno.open(filePath)).readable;
const resp = new Response(body);
resp.headers.set("content-length", fileSize.toString());
resp.headers.set("content-type", "text/html; charset=utf-8");
return resp;
} |
Beta Was this translation helpful? Give feedback.
I figured some things out, see here https://github.com/dnk8n/rethinkcode/tree/integrate-lume
It is currently working at https://rethinkcode--integrate-lume.deno.dev/
e.g. https://rethinkcode--integrate-lume.deno.dev/projects/mercede-benz
Prettier site to come!
The main change happens at routes/_middleware.ts: