This project is designed to test and improve the Largest Contentful Paint (LCP) metric by experimenting with different image loading techniques. For more information visit Core Web Vitals - Optimize LCP Image
The project includes multiple versions of a simple HTML page, each with different image loading strategies:
- Normal image loading
- Lazy loading
- Preloading
- Resized images
- Converted images (WebP, AVIF, Picture tag)
-
Clone the repository:
git clone https://github.com/corewebvitals/lcp-image.git cd lcp-test
-
Upload the files to a simple webserver. Self hosting this project on localhost will not mimic real world results
- Open
index.html
in your browser. - Click on the different versions of the HTML pages listed to see how each technique affects the LCP metric.
- The average LCP value for each version is stored in the session storage and displayed next to the corresponding link.
- First upload all the files to your webserver
- Open the developer tools (F12) and go to the network tab
- Disable your browsers cache by checking the disable cache checkbox
- Keep the network tab open!! If you close it you you will just test your broser cache
- Click on the start test button
index.html
: Main page listing all versions.css/
: Directory containing CSS files.js/
: Directory containing JavaScript files.images/
: Directory containing images used in the tests.
- The project loads Bootstrap CSS and JS to more closely mimic real world sites.
- Chart.js is used to visualize the LCP metrics.
This project is licensed under the MIT License.