og/lib/render.js
2023-12-16 22:36:07 -05:00

13 lines
406 B
JavaScript

import html2png from '@besties/html2png'
import fs from 'node:fs'
const style = fs.readFileSync('./assets/style.css', 'utf8')
export default async function (html, options = {}) {
return html2png(`<style>${style}</style>${html}`, options)
}
export async function renderHtml(html) {
const styleNow = await fs.promises.readFile('./assets/style.css', 'utf8')
return `<style>${styleNow}</style>${html}`
}