Performance Improvements: Optimize JavaScript, CSS, and Resource Loading #88
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements comprehensive performance optimizations to improve page load times, runtime performance, and Core Web Vitals scores for adrianmato.com. All changes follow progressive enhancement principles with proper fallbacks for older browsers.
Changes
JavaScript Performance Optimizations
Scroll Event Throttling (
assets/js/s.js)The scroll event handler was firing on every scroll event, causing excessive DOM queries and potential performance issues. Implemented
requestAnimationFramethrottling to align scroll handling with the display refresh rate:Benefits:
Removed Unused Dependency
The
ios.jslibrary (4KB minified) was loaded but never used in the codebase. Modern CSS handles iOS viewport height issues natively withvhunits, making this polyfill unnecessary.CSS Performance Optimizations
Accessibility-Aware Smooth Scrolling (
_sass/_base.scss)Made smooth scrolling conditional on user preferences to improve accessibility and reduce unnecessary animations:
Rendering Performance (
_sass/_layout.scss)will-change: transformto animated elements, allowing the browser to optimize rendering layer creationcontent-visibility: autoto project cards to defer rendering of off-screen contentResource Loading Optimizations
Async Font Loading (
_includes/head.html)Converted Google Fonts from synchronous to asynchronous loading to prevent render-blocking:
Resource Hints
cloud.umami.is)crossoriginattribute to font preconnects for CORS requestsDocumentation
Created comprehensive documentation:
Expected Impact
Note: These are estimated improvements based on web performance best practices. Actual results will vary depending on device capabilities, network conditions, and content. Verify with tools like Lighthouse, WebPageTest, or PageSpeed Insights.
Security
✅ No security vulnerabilities found (CodeQL scan passed)
Browser Compatibility
All optimizations gracefully degrade:
content-visibility: Ignored by older browsersprefers-reduced-motion: Falls back to smooth scrollingTesting Recommendations
To verify improvements in your specific environment:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.