Files
anotherreflections-website-v2/scripts/build-favicon.mjs
Dmitry Gusev 048cb673e0
All checks were successful
deploy / deploy (push) Successful in 1m33s
security / security (push) Successful in 2m41s
feat(brand): актуальный фавикон по брендовому знаку
Старый favicon.svg (стилизованная «A» от скаффолдинга) заменён на
оптимизированный для 16-32px вариант logo-mark: кривые-отражения +
точка на тёмном фоне, тот же градиент #b794ff→#6c4ed4.

- public/favicon.svg — новый 64×64 viewBox, утолщённые штрихи
- public/favicon.ico — 32×32 (sharp → PNG-in-ICO)
- public/apple-touch-icon.png — 180×180 для iOS
- scripts/build-favicon.mjs + npm run build:favicon
- BaseLayout: добавлены <link> на ico (fallback) и apple-touch-icon
2026-05-25 13:33:22 +03:00

29 lines
947 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.
#!/usr/bin/env node
// Генерирует public/favicon.ico (32x32 PNG-in-ICO, как у Astro по умолчанию)
// и public/apple-touch-icon.png (180x180) из public/favicon.svg.
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import sharp from 'sharp';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const ROOT = path.resolve(__dirname, '..');
const svgPath = path.join(ROOT, 'public/favicon.svg');
const svg = fs.readFileSync(svgPath);
const targets = [
{ out: 'public/favicon.ico', size: 32 },
{ out: 'public/apple-touch-icon.png', size: 180 },
];
for (const { out, size } of targets) {
const dst = path.join(ROOT, out);
await sharp(svg, { density: 384 })
.resize(size, size)
.png({ compressionLevel: 9 })
.toFile(dst);
const kb = (fs.statSync(dst).size / 1024).toFixed(1);
console.log(`wrote ${out} (${size}x${size}) — ${kb} KB`);
}