RealEvanPonter / web-performance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Website Performance Optimization portfolio project

Your challenge, if you wish to accept it (and we sure hope you will), is to optimize this online portfolio for speed! In particular, optimize the critical rendering path and make this page render as quickly as possible by applying the techniques you've picked up in the Critical Rendering Path course.

To get started, check out the repository, inspect the code,

Getting started

Some useful tips to help you get started:

  1. Check out the repository
  2. To inspect the site on your phone, you can run a local server
$> cd /path/to/your-project-folder
$> python -m SimpleHTTPServer 8080
  1. Open a browser and visit localhost:8080
  2. Download and install ngrok to make your local server accessible remotely.
$> cd /path/to/your-project-folder
$> ngrok 8080
  1. Copy the public URL ngrok gives you and try running it through PageSpeed Insights! More on integrating ngrok, Grunt and PageSpeed.

Profile, optimize, measure... and then lather, rinse, and repeat. Good luck!

Optimization Tips and Tricks

Customization with Bootstrap

The portfolio was built on Twitter's Bootstrap framework. All custom styles are in dist/css/portfolio.css in the portfolio repo.

Sample Portfolios

Feeling uninspired by the portfolio? Here's a list of cool portfolios I found after a few minutes of Googling.

Running Instructions

Navigate to http://realevanponter.github.io/ Choose a link of interest Scroll as desired

If you choose Cam's Pizzeria, you can choose which size of pizza you would like to see on the screen using the slider.

Optimizations Outline

index.html

Loading an external font was render-blocking the text on the page. Removing this resource improved the speed of the inital load.

Inlining the CSS proved to speed up the page load, since there was one less roundtrip for a resource

main.js (for pizza.html)

The changePizzaSizes function was refactored to improve performance. Instead of using pixels to specify a new size, it uses a percentage value that is calculated before iterating through each pizza element and changing the size. A variable is used to store the length of randomPizzas instead of having to calculate it on each iteration.

The function that runs when DOMContentLoaded is called was not effectively calculating how many pizza elements would need to be created. It now uses the height of the window to determine how many rows of pizzas to make. This reduces the number of elements that are created, and speeds up the performance of the page.

Resources

I followed along with the two web performance courses for this project very closely and started working on this project as they were going over topics that related directly to speeding up the performance of this website. The only function I had to look up was the window.innerHeight() function, which I found on developer.mozilla.org

About


Languages

Language:JavaScript 56.5%Language:HTML 41.0%Language:CSS 2.6%