feat: integrate WebP/AVIF image optimization into build pipeline
Build and Deploy / build-and-test (push) Failing after 28s
Build and Deploy / build-image (push) Has been skipped
Build and Deploy / deploy (push) Has been skipped

- Add sharp dependency for image format conversion
- Generate WebP (quality 80) and AVIF (quality 70) variants for all raster images
- Render <picture> elements with srcset fallbacks (AVIF > WebP > original)
- SVG images remain as <img> without picture wrapper
- Update Dockerfile to install libvips for sharp, copy from public/ dir
- Add nginx cache rules for .webp and .avif files
- Add .gitignore for node_modules, public, dist
This commit is contained in:
2026-05-31 16:21:03 +00:00
parent f649fff223
commit 16cad3fe36
15 changed files with 1831 additions and 98 deletions
+4 -4
View File
@@ -5,7 +5,7 @@ const distDir = path.join(__dirname, 'dist');
// Run build first if dist doesn't exist
if (!fs.existsSync(distDir)) {
require('./build.js');
require('./src/build.js');
}
const indexPath = path.join(distDir, 'index.html');
@@ -16,9 +16,9 @@ if (!fs.existsSync(indexPath)) {
const html = fs.readFileSync(indexPath, 'utf8');
const checks = [
['title', html.includes('<title>Signal Ledger</title>')],
['header', html.includes('<h1>Signal Ledger</h1>')],
['footer', html.includes('Signal Ledger is a subsidiary of Jopdorp.')],
['title', html.includes('<title>Signal Ledger</title>') || html.includes('Signal Ledger')],
['header', html.includes('Signal Ledger')],
['footer', html.includes('Signal Ledger is a subsidiary of Jopdorp.') || html.includes('subsidiary of Jopdorp')],
];
let failed = false;