Skip to content

feat: add PageSpeed optimizations for exported projects#29

Open
maboudharam wants to merge 1 commit intoyoanbernabeu:mainfrom
maboudharam:feat/pagespeed-optimization
Open

feat: add PageSpeed optimizations for exported projects#29
maboudharam wants to merge 1 commit intoyoanbernabeu:mainfrom
maboudharam:feat/pagespeed-optimization

Conversation

@maboudharam
Copy link
Contributor

@maboudharam maboudharam commented Jan 14, 2026

Description

JavaScript & Build:

  • Add Terser minification with console/debugger removal
  • Add Gzip and Brotli compression via vite-plugin-compression
  • Add vendor chunk splitting for React

CSS & Fonts:

  • Add critical CSS inline in index.html
  • Add font-display: swap and latin subset for Google Fonts
  • Add preconnect and dns-prefetch for external resources

Images:

  • Add WebP conversion for PNG/JPG images (Canvas API)
  • Add elements with WebP fallback
  • Add lazy loading and width/height attributes
  • Pre-compute WebP URLs and video detection (avoid regex per render)

Caching:

  • Add cache headers for Vercel (vercel.json)
  • Add cache headers for Netlify (netlify.toml)
  • 1 year max-age for static assets

Code quality:

  • Centralize regex patterns in helpers.ts
  • Add isWebpConvertible() utility function
  • Parallelize WebP conversions with Promise.all()
  • Filter non-convertible formats (SVG, GIF, WebP)

Related Issue

Closes #23

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🎨 Style/UI improvement
  • ♻️ Code refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🔧 Configuration/build changes

Checklist

  • My code follows the project's code style
  • I have run npm run lint and fixed any issues
  • I have run npm run format to format my code
  • I have run npm run type-check with no errors
  • I have tested my changes locally with npm run dev
  • I have added/updated documentation if needed
  • My changes generate no new warnings

Screenshots (if applicable)

screenshot_20260114_231014

Additional Notes

All optimizations are applied to the exported project, not the OpenBento builder itself.

JavaScript & Build:
- Add Terser minification with console/debugger removal
- Add Gzip and Brotli compression via vite-plugin-compression
- Add vendor chunk splitting for React

CSS & Fonts:
- Add critical CSS inline in index.html
- Add font-display: swap and latin subset for Google Fonts
- Add preconnect and dns-prefetch for external resources

Images:
- Add WebP conversion for PNG/JPG images (Canvas API)
- Add <picture> elements with WebP fallback
- Add lazy loading and width/height attributes
- Pre-compute WebP URLs and video detection (avoid regex per render)

Caching:
- Add cache headers for Vercel (vercel.json)
- Add cache headers for Netlify (netlify.toml)
- 1 year max-age for static assets

Code quality:
- Centralize regex patterns in helpers.ts
- Add isWebpConvertible() utility function
- Parallelize WebP conversions with Promise.all()
- Filter non-convertible formats (SVG, GIF, WebP)

Closes yoanbernabeu#23
@maboudharam
Copy link
Contributor Author

Performance is OK, but accessibility & SEO could be improved I think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Optimize exported project for better PageSpeed score

1 participant