info-canicule/scripts/build-favicon.mjs
Florian d5c0b0968d
All checks were successful
Deploy info-canicule / deploy (push) Successful in 1m31s
feat(brand): refonte favicon + og-image, reskin /soutenir
- favicon.svg : nouveau logo (sun + brand + droplet) cohérent avec le header
- favicon-32 / favicon-192 / apple-touch-icon générés par scripts/build-favicon.mjs (sharp)
- og-image refait avec la nouvelle identité (paper, Manrope-like, pills vigilance avec glyphes)
- Base.astro : link rel icon + apple-touch-icon ajoutés
- /soutenir : reskin (kicker + h1 accentué + barre d'objectif en brand-tint, blocs ic-card), fonctionnalité Ko-fi conservée

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 19:13:30 +02:00

27 lines
989 B
JavaScript
Raw 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
// Génère les fallbacks PNG du favicon (apple-touch-icon + 32px) depuis public/favicon.svg.
// Lancé à la demande quand le SVG change : `node scripts/build-favicon.mjs`.
import sharp from 'sharp';
import { readFileSync } from 'node:fs';
import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const SVG = resolve(__dirname, '../public/favicon.svg');
const buf = readFileSync(SVG);
const outputs = [
{ path: '../public/apple-touch-icon.png', size: 180 },
{ path: '../public/favicon-32.png', size: 32 },
{ path: '../public/favicon-192.png', size: 192 },
];
for (const o of outputs) {
const dest = resolve(__dirname, o.path);
await sharp(buf, { density: 384 })
.resize(o.size, o.size, { fit: 'contain', background: { r: 0, g: 0, b: 0, alpha: 0 } })
.png({ compressionLevel: 9 })
.toFile(dest);
console.log(`Wrote ${dest} (${o.size}×${o.size})`);
}