feat: add SVG icon and generate PNG icons
All checks were successful
Deploy via FTP / deploy (push) Successful in 3s
All checks were successful
Deploy via FTP / deploy (push) Successful in 3s
- Added a new SVG icon file for the application. - Created a manifest.json file for the web app with relevant metadata. - Introduced package-lock.json to manage dependencies. - Implemented a script to generate PNG icons from the SVG source using sharp.
This commit is contained in:
24
scripts/generate-icons.js
Normal file
24
scripts/generate-icons.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const sharp = require('sharp');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const src = path.join(__dirname, '../icons/icon.svg');
|
||||
const out = path.join(__dirname, '../icons');
|
||||
|
||||
const sizes = [
|
||||
{ name: 'apple-touch-icon.png', size: 180 },
|
||||
{ name: 'icon-192.png', size: 192 },
|
||||
{ name: 'icon-512.png', size: 512 },
|
||||
{ name: 'favicon-32.png', size: 32 },
|
||||
];
|
||||
|
||||
(async () => {
|
||||
const svg = fs.readFileSync(src);
|
||||
for (const { name, size } of sizes) {
|
||||
await sharp(svg)
|
||||
.resize(size, size)
|
||||
.png()
|
||||
.toFile(path.join(out, name));
|
||||
console.log(`✓ ${name} (${size}×${size})`);
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user