Mercurial
diff mrjunejune/generate-icons.sh @ 241:9c2eec61a152
[assets] Generate site images as WebP with Bazel
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 03 Aug 2026 11:26:30 -0700 |
| parents | 3b47e82ac57e |
| children |
line wrap: on
line diff
--- a/mrjunejune/generate-icons.sh Mon Aug 03 10:48:59 2026 -0700 +++ b/mrjunejune/generate-icons.sh Mon Aug 03 11:26:30 2026 -0700 @@ -1,42 +1,8 @@ -#!/bin/bash - -# Generate PWA icons from SVG -# Requires ImageMagick: apt-get install imagemagick - -cd "$(dirname "$0")/src/public" - -if ! command -v convert &> /dev/null; then - echo "❌ ImageMagick not found. Please install it:" - echo " Ubuntu/Debian: sudo apt-get install imagemagick" - echo " macOS: brew install imagemagick" - echo "" - echo "Or use an online tool: https://realfavicongenerator.net/" - exit 1 -fi - -echo "🎨 Generating PWA icons from epi_all_colors.svg..." +#!/usr/bin/env bash +set -euo pipefail -# 192x192 icon -echo " → Creating icon-192.png..." -convert epi_all_colors.svg -resize 192x192 -background none icon-192.png - -# 512x512 icon -echo " → Creating icon-512.png..." -convert epi_all_colors.svg -resize 512x512 -background none icon-512.png - -# Maskable icon (512x512 with safe zone - 80% of size) -echo " → Creating icon-maskable-512.png..." -convert epi_all_colors.svg -resize 409x409 -background none -gravity center -extent 512x512 icon-maskable-512.png +workspace="$(hg root)" +cd "$workspace" -echo "" -echo "✅ Icons generated successfully!" -echo "" -echo "Generated files:" -echo " - icon-192.png" -echo " - icon-512.png" -echo " - icon-maskable-512.png" -echo "" -echo "Next steps:" -echo " 1. Verify icons look good: ls -lh src/public/icon-*.png" -echo " 2. Test PWA: Open site in Chrome → DevTools → Application → Manifest" -echo " 3. Run Lighthouse audit to check PWA score" +bazel build //mrjunejune:generated_webp_assets +echo "Generated WebP assets are under bazel-bin/mrjunejune/generated_webp/."