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.
25 lines
648 B
JavaScript
25 lines
648 B
JavaScript
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})`);
|
||
}
|
||
})();
|