The aim of this project was to
- Optimize PageSpeed Insights score for index.html
- Optimize Frames per Second in pizza.html
Follow the steps below to set up the project
- Clone or download the repo.
- Navigate to the project directory and run
npm install
to install all the node dependencies. - Run
grunt
to apply automated optimizations like minification and image compression. - The
dist
folder contains the production optimized version andsrc
folder contains the development version. - You can also check the app hosted on github.io.
- Resized and compressed image "pizzeria.jpg" to reduce size by 99%.
- Moved scripts to bottom of
index.html
just before the</body>
tag to unblock CRP. - Added media query to print stylesheets to unblock rendering.
- Achived 50% reduction in transferred bytes by minifying and combining scripts using
grunt-contrib-uglify
plugin. - Removed render blocking CSS using
grunt-critical
plugin. - Used
grunt-contrib-imagemin
plugin to optimize and compress images. This saved 103 KB of data.
After performing these optimizations, the Page Speed score improved to 95+ for both mobile and desktop.
- Wrap the function body inside requestAnimationFrame
- Fetch and assign "scrollTop" outside of the loop
- Reduce the number of movable pizza elements from 200 to 30, since rest of the pizza elements are outside the viewport due to fixed positioning and performance depends on the number of elements modified.