Updated
This commit is contained in:
parent
afb5f3a287
commit
db3736b71f
16 changed files with 203 additions and 181 deletions
21
frontend/node_scripts/generateFavicon.js
Normal file
21
frontend/node_scripts/generateFavicon.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { consola } from 'consola';
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import sharp from 'sharp';
|
||||
(async () => {
|
||||
try {
|
||||
const dirPath = path.resolve('../../../public')
|
||||
|
||||
if (fs.existsSync(dirPath)) {
|
||||
const inputSrc = '../../assets/images/logo.png'
|
||||
const favicon = dirPath + '/favicon.png'
|
||||
const faviconBuffer = await sharp(inputSrc).png({ quality: 90 }).resize(50).toBuffer()
|
||||
await sharp(faviconBuffer).toFile(favicon)
|
||||
consola.success('Favicon generated successfully')
|
||||
} else {
|
||||
consola.error('Directory does not exist:', dirPath)
|
||||
}
|
||||
} catch (error) {
|
||||
consola.error('Error generating favicon:', error)
|
||||
}
|
||||
})()
|
||||
Loading…
Add table
Add a link
Reference in a new issue