From 6956faad469a13b0b4788f3962338aaa31547d04 Mon Sep 17 00:00:00 2001 From: hazycora Date: Thu, 21 Dec 2023 06:47:27 -0600 Subject: [PATCH] change how debug layout works --- lib/render.js | 26 ++++++++++++++++++++++++-- views/layout.eta | 23 ----------------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/lib/render.js b/lib/render.js index fdb90a2..02c1e0f 100644 --- a/lib/render.js +++ b/lib/render.js @@ -1,4 +1,4 @@ -import html2png from '@besties/html2png' +import html2png, { renderHTML as inline } from '@besties/html2png' import fs from 'node:fs' const style = fs.readFileSync('./assets/style.css', 'utf8') @@ -9,5 +9,27 @@ export default async function (html, options = {}) { export async function renderHtml(html) { const styleNow = await fs.promises.readFile('./assets/style.css', 'utf8') - return `${html}` + return ( + ` + + + + OpenGraph Debug Preview +` + (await inline(`${html}`)) + ) } diff --git a/views/layout.eta b/views/layout.eta index f45b730..35748c3 100644 --- a/views/layout.eta +++ b/views/layout.eta @@ -1,26 +1,3 @@ -<% if (it.debug) { %> - - - - - OpenGraph Debug Preview - -<% } %>
<%~ it.body %> <% if (it.languages) { %>