Files
ChooserApp/scripts/generate-icons.js
Tobias Leuschner 768b6f441f
All checks were successful
Deploy via FTP / deploy (push) Successful in 3s
feat: add SVG icon and generate PNG icons
- 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.
2026-02-22 12:20:04 +01:00

25 lines
648 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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})`);
}
})();