Giter Site home page Giter Site logo

frontend-nanodegree-mobile-portfolio's Introduction

Website Performance Optimization portfolio project

Getting started

Gulp

This project uses Gulp as the build system. In order to run it you first need to install and run Gulp as follows:

npm install gulp-cli -g

npm install

gulp

Gulp is being used to minify and autoprefix CSS, uglify JS, and inline most of the resulting assets. src_index.html is the working file, dist/index.html is the Gulp task-runners output. Thus, any changes should be applied at src_index.html, since index.html gets overwritten every time Gulp runs.

Run

Once built, the final project is in the dist directory. From there you can just open the index.html in the browser. If you prefer, you can also serve the project from a webserver by running any of the below commands:

  • node's http-server or
  • Python's SimpleHTTPServer, like so: python -m SimpleHTTPServer 8080

Tunnel to localhost

In case you wish to check the pagespeed insights score, or make the side available to the outside world for any other purpose, it is recommended you use ngrok. You can download and install it here.

After installing it, you can run ngrok http 8080, while at the same time running a webserver on port 8080. The forwarding link to the project will be displayed by the ngrok CLI.

Optimizations

index.html

  • Minified HTML
  • Minified CSS
  • Inlined JS and CSS
  • Uglified JS
  • Images have been compressed and optimized

views/js/main.js

  • updatePositions: This code has been split into 2 batch processes. The first one reads layout for every .mover element. The second one sets the left style attribute for all of those elements. This results in a much faster animation while scrolling.
  • changePizzaSizes: The code was changed to prevent FSL. Now there are two batch processes taking place. One for reading layout properties, the other one to modify the styles. Since all pizzas have the same size, the determineDX function call has been taken out of the loop and applied to only the first one.
  • DOMContentLoaded event listener function: The amount of .mover pizzas has been decreased by calculating it dynamically, based on the screen height. Since the vast majority of them were never visible, the user won't notice any difference in their quantity.

views/css/style.css

  • .mover class: The pizzas have been placed each on their own composition layer to prevent them from being repainted on every movement.

frontend-nanodegree-mobile-portfolio's People

Contributors

wolfgangbecker avatar durant-udacity avatar cameronwp avatar susansmith avatar safadurimo avatar walesmd avatar hkasemir avatar mrk-nguyen avatar nicolasartman avatar aaronbutler avatar

Watchers

James Cloos avatar  avatar

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.