Coder Social home page Coder Social logo

otsop110 / frontend-nanodegree-mobile-portfolio Goto Github PK

View Code? Open in Web Editor NEW

This project forked from udacity/frontend-nanodegree-mobile-portfolio

0.0 2.0 0.0 6.51 MB

Website Performance Optimization Portfolio - Udacity Front End Web Developer ND

CSS 5.34% HTML 38.87% JavaScript 55.79%

frontend-nanodegree-mobile-portfolio's Introduction

Udacity P4: Website Performance Optimization Portfolio

Project overview

This project consists of two main parts. First challenge was to optimize the index.html so that both mobile and desktop pagespeed measurements were higher than 90%. The second task was to improve the web performance of Cam's pizzeria page.

Getting started

####Part 1: Optimize PageSpeed Insights score for index.html

I followed these instructions to get started:

  1. Run a local server.
$> cd /path/to/your-project-folder
$> python -m SimpleHTTPServer 8080
  1. Download and install ngrok to access your local server remotely.
$> cd /path/to/your-project-folder
$> ngrok http 8080

####Part 2: Optimize Frames per Second in pizza.html

The aim of optimizing views/pizza.html is to achieve frames per second rate 60 fps or higher by modifying views/js/main.js. Chrome developer tools came handy in measuring the fps rate.

Measured results

By PageSpeed Insights for Mobile portfolio page (index.html):

  • 94% speed on mobile
  • 95% speed on desktop
  • 100% mobile user experience

By Chrome Developer Tools for Cam's Pizzeria (views/pizza.html & views/js/main.js)

  • scrolling at 60 fps
  • time to resize pizza less than 5ms

Executed optimizations

Mobile portfolio page

  • Inlined CSS
  • Used Web Front Loader asynchronously
  • Asynced JS
  • Compressed images with Grunt Imagemin
  • Resized images with Grunt responsive-images
  • Added srcset to images
  • Minified JS files with Grunt uglify

Cam's Pizzeria

  • Udacity Forum and Fend office hours webcasts provided a great starting point for removing jank caused by forced synchronous layout in 'changePizzaSizes' and 'updatePositions' functions. Thanks also to karoldavid for excellent explanations of how and why certain optimizations were done. I followed his excellent idea in introducing an array for pizzas and counting the number of pizzas needed to show on page by page width.
  • Moved variables and accessed the DOM outside of For loops to decrease scripting time.
  • Used 'document.getElementsByClassName()' instead of 'document.querySelectorAll()' in order to decrease layout time.
  • As suggested in the Udacity FEND discussion forum, I experimented with 'transform: translateX()' which did not improve the performance greatly. I also added 'backface-visibility: hidden;' to the mover class in 'views/css/style.css'.
  • Compressed pizza.png and pizzeria.jpg images with Grunt imagemin and resized them with Grunt responsive-images.
  • Added alt and srcset to the images.
  • Minified JS files with Grunt uglify.

Valuable links

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.