Resources used for project:
- Code School (https://www.codeschool.com) for Javascript class
- Udacity class on Browser Rendering Optimization
- Udacity P4 Forum discussions
Changes in this submission:
- Added media attribute print for print.css
- Made Google Analytics script Async
- Loaded the Google Fonts Asynchronously through WebFontConfig API
- Used gulp-inline-css plugin to inline style.css in index.html
Changes in previous submission:
- As for my last submission I was told to move the minified version of the JS and CSS files to dist folder, I forgot to add that change of location in index.html and hence the performance scores decreased. I have made the change to show the correct location of the files.
- As I am using the translateX property of the transform function, made the change as suggested by the reviewer in /views/js/main.js line 581 from elem.basicLeft = (i % cols) * s to elem.style.left = (i % cols) * s + 'px'
- As suggested by the reviewers, added vendor prefixes to line 36 of views/css/style.css by using Autoprefixer tool.
How to Run:
Part 1:
- Ran PageSpeed to optimize.
- I placed the CSS and JS minified files in dist folder as mentioned by the last project reviewer.
Part 2:
- Download the repository from my GitHub Page https://github.com/fparviz/Project4
- In the folder 'views', open the html file 'pizza.html' using Google Chrome
- Scroll the website to see the pizza animation
Optimizations made in views/js/main.js:
- From looking at the timeline of the original site, I was able to identify that the problem lied in the function updatePositions.
- I added a worker thread animationReadyCheck that calls updatePosition rather than having it in the main thread.
- From animating Layout, I changed it to use transform and precalculated phases.
- I reduced the the number of pizzas being created in function updatePositions
- To improve loading performance, I moved pizzasDiv Variable outside the for loop in function changePizzaSizes
- Fixed typos in submission#2 and made improvements to save array lengths in variables in for loops
- In function Update Position I declared the elem variable outside the loop to prevent it from being created every time the loop is executed.
Optimizations made for PageSpeed:
- Used ImageOptim tool on images
- Minified Resources