switch to eta
This commit is contained in:
parent
c0faaf51ff
commit
578279a07d
7 changed files with 2784 additions and 1016 deletions
35
lib/render.js
Normal file
35
lib/render.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
import html2png from '@besties/html2png'
|
||||
import fs from 'node:fs'
|
||||
|
||||
const figtreeRegular = fs.readFileSync('./assets/Figtree-Regular.woff')
|
||||
const figtreeMedium = fs.readFileSync('./assets/Figtree-Medium.woff')
|
||||
const figtreeExtraBold = fs.readFileSync('./assets/Figtree-ExtraBold.woff')
|
||||
|
||||
const css = fs.readFileSync('./assets/style.css', 'utf8')
|
||||
|
||||
const renderOptions = {
|
||||
fonts: [
|
||||
{
|
||||
name: 'Figtree',
|
||||
data: figtreeRegular,
|
||||
weight: 400,
|
||||
style: 'normal'
|
||||
},
|
||||
{
|
||||
name: 'Figtree',
|
||||
data: figtreeMedium,
|
||||
weight: 500,
|
||||
style: 'normal'
|
||||
},
|
||||
{
|
||||
name: 'Figtree',
|
||||
data: figtreeExtraBold,
|
||||
weight: 800,
|
||||
style: 'normal'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
export default function (html) {
|
||||
return html2png(html, css, renderOptions)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue