Updated
This commit is contained in:
parent
d61b8b7bd8
commit
46783c4f38
57 changed files with 4178 additions and 5992 deletions
33
frontend/@dasig/scripts/node/optimizeLogo.js
Normal file
33
frontend/@dasig/scripts/node/optimizeLogo.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { consola } from 'consola';
|
||||
import sharp from 'sharp';
|
||||
import yargs from 'yargs';
|
||||
import { hideBin } from 'yargs/helpers';
|
||||
|
||||
(async () => {
|
||||
const argv = yargs(hideBin(process.argv))
|
||||
.option('size', {
|
||||
alias: 's',
|
||||
describe: 'Specify the size of the logo',
|
||||
type: 'number',
|
||||
demandOption: true,
|
||||
})
|
||||
.argv;
|
||||
|
||||
const size = argv.size;
|
||||
|
||||
try {
|
||||
const webpImage = './src/@dasig/images/logo.webp'
|
||||
const avifImage = './src/@dasig/images/logo.avif'
|
||||
const inputSrc = './src/images/logo.png'
|
||||
|
||||
const avifBuffer = await sharp(inputSrc).avif({ quality: 60 }).resize(size).toBuffer()
|
||||
await sharp(avifBuffer).toFile(avifImage)
|
||||
consola.success('Logo successfully optimized in Avif')
|
||||
|
||||
const webpBuffer = await sharp(inputSrc).webp({ quality: 75 }).resize(size).toBuffer()
|
||||
await sharp(webpBuffer).toFile(webpImage)
|
||||
consola.success('Logo successfully optimized in Webp')
|
||||
} catch (error) {
|
||||
consola.error('Error generating favicon:', error)
|
||||
}
|
||||
})()
|
||||
Loading…
Add table
Add a link
Reference in a new issue