Added fwt components
This commit is contained in:
parent
b7409d1c13
commit
b2cbd947c5
30 changed files with 852 additions and 0 deletions
21
fwt/components/Optimizer/OptimizeLogo.tsx
Normal file
21
fwt/components/Optimizer/OptimizeLogo.tsx
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import sharp from 'sharp'
|
||||
|
||||
interface Props {
|
||||
size?: number
|
||||
}
|
||||
|
||||
const convertLogo = async (props: Props) => {
|
||||
const inputSrc = 'src/assets/images/logo.png'
|
||||
const webpImage = 'fwt/images/logo.webp'
|
||||
const avifImage = 'fwt/images/logo.avif'
|
||||
|
||||
const avifBuffer = await sharp(inputSrc).avif({ quality: 60 }).resize(props.size).toBuffer()
|
||||
await sharp(avifBuffer).toFile(avifImage)
|
||||
|
||||
const webpBuffer = await sharp(inputSrc).webp({ quality: 75 }).resize(props.size).toBuffer()
|
||||
await sharp(webpBuffer).toFile(webpImage)
|
||||
}
|
||||
|
||||
export default (props: Props) => {
|
||||
convertLogo(props)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue