- Access via this link: http://www.danafng.com/frontend-nanodegree-mobile-portfolio/
- Start local server:
$> cd /path/to/your-project-folder
$> python -m SimpleHTTPServer 8080
- Get the project up and running for PageSpeed testing (ngrok is included in the repo):
$> cd /path/to/your-project-folder
$> ./ngrok http 8080
The following are a list of optimizations that I did in order to get a 90 or above speed score for the website, and to improve the pizza.html to 60 FPS:
- Create a gulpfile.js that minifies html, css, and images
- Used Base64 Image Encoder for index.html images to optimize images; optimized images are in index.html, and pizza.html, also replaced pizza.png with pizza.min.png in main.js
- Added Cache-Control [Resource: https://varvy.com/pagespeed/cache-control.html]
- Used optimizilla to reduce the size of pizza.jpg (now pizza-min.jpg) down
- inlined css for both index.html and pizza.html
- reordered script tags in index.html
- in views/css/style.css added transform: translateZ(0) and backface-visibility: hidden to increase speed on .mover selector
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 and inspect the code.
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 the top-level of your project directory 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!
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.