Added option to generate favicon
This commit is contained in:
parent
29d02a0c5a
commit
1e3dc7ddad
1 changed files with 13 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ import sharp from 'sharp'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
size?: number
|
size?: number
|
||||||
|
favicon?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const convertLogo = async (props: Props) => {
|
const convertLogo = async (props: Props) => {
|
||||||
|
|
@ -16,6 +17,18 @@ const convertLogo = async (props: Props) => {
|
||||||
await sharp(webpBuffer).toFile(webpImage)
|
await sharp(webpBuffer).toFile(webpImage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const generateFavicon = async (props: Props) => {
|
||||||
|
const inputSrc = 'src/assets/images/logo.png'
|
||||||
|
const favicon = 'public/favicon.png'
|
||||||
|
|
||||||
|
const faviconBuffer = await sharp(inputSrc).png({ quality: 90 }).resize(50).toBuffer()
|
||||||
|
await sharp(faviconBuffer).toFile(favicon)
|
||||||
|
}
|
||||||
|
|
||||||
export default (props: Props) => {
|
export default (props: Props) => {
|
||||||
convertLogo(props)
|
convertLogo(props)
|
||||||
|
|
||||||
|
if (props.favicon) {
|
||||||
|
generateFavicon(props)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue