13 lines
406 B
JavaScript
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}`
|
|
}
|