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,
####Part 1: Optimize PageSpeed Insights score for index.html
Some useful tips to help you get started:
- Check out the repository
- To inspect the site on your phone, you can run a local server
$> cd /path/to/your-project-folder
$> python -m SimpleHTTPServer 8080
- Open a browser and visit localhost:8080
- Download and install ngrok to make your local server accessible remotely.
$> cd /path/to/your-project-folder
$> ngrok http 8080
- Copy the public URL ngrok gives you and try running it through PageSpeed Insights! Optional: More on integrating ngrok, Grunt and PageSpeed.
Profile, optimize, measure... and then lather, rinse, and repeat. Good luck!
####Part 2: Optimize Frames per Second in pizza.html
To optimize views/pizza.html, you will need to modify views/js/main.js until your frames per second rate is 60 fps or higher. You will find instructive comments in main.js.
You might find the FPS Counter/HUD Display useful in Chrome developer tools described here: Chrome Dev Tools tips-and-tricks.
- Optimizing Performance
- Analyzing the Critical Rendering Path
- Optimizing the Critical Rendering Path
- Avoiding Rendering Blocking CSS
- Optimizing JavaScript
- Measuring with Navigation Timing. We didn't cover the Navigation Timing API in the first two lessons but it's an incredibly useful tool for automated page profiling. I highly recommend reading.
- The fewer the downloads, the better
- Reduce the size of text
- Optimize images
- HTTP caching
The portfolio was built on Twitter's Bootstrap framework. All custom styles are in dist/css/portfolio.css
in the portfolio repo.
Feeling uninspired by the portfolio? Here's a list of cool portfolios I found after a few minutes of Googling.
- A great discussion about portfolios on reddit
- http://ianlunn.co.uk/
- http://www.adhamdannaway.com/portfolio
- http://www.timboelaars.nl/
- http://futoryan.prosite.com/
- http://playonpixels.prosite.com/21591/projects
- http://colintrenter.prosite.com/
- http://calebmorris.prosite.com/
- http://www.cullywright.com/
- http://yourjustlucky.com/
- http://nicoledominguez.com/portfolio/
- http://www.roxannecook.com/
- http://www.84colors.com/portfolio.html
Performance Fixes
-
Set media to print for print style sheet for index.html, project-webperf.html, project-2048.html, and project-mobile.html.
-
Added https: to the google fonts link for all html pages.
-
Moved layout call of scrollTop out of for loop for updatePositions function.
-
Deleted determineDx function which causes force synchronous layout by setting newwidth using percent not pixels.
-
Added async tags to analytics script tags.
-
Stored randomPizCont.length outside of for loop in into randomPizContLength for function changePizzaSizes.
-
Stored times.length outside of for loop in variable itemsLength for function updatePositions.
-
Moved randomPizzas selector call to variable pizzasDiv out of for loop.
-
Declared phase variable outside of for loop for updatePositions function.
-
Declared elem outside of for loop.
-
Moved document.querySelector("#movingPizzas1") outside of for loop and stored it in variable movingPizzas.
-
Reduced number of moving pizzas to 24 pizzas.
-
Replaced querySelectorAll with getElementById and getElementsByClassName when appropriate.
-
moved javascript script tags to bottom of html in index.html.
-
Converted jpg images to gif images in index image folder.
-
Inlined CSS and removed CSS link.
-
Moved google font into javascript file at bottom.
-
Added will-change:transform and transform:translateZ(0) to .mover class.
-
Resized pizzeria image to 100 x 75 and compressed the image to 105 kb using compressor.io.
How to Use Application
-
Run index.html in a browser
-
Click on the links to look at the different projects in portfolio
-
The pizza project changes background when you slide up and down and changes pizzas when you slide bar