Giter Club home page Giter Club logo

test01's Introduction

网站性能优化项目

你要做的是尽可能优化这个在线项目的速度。注意,请应用你之前在网站性能优化课程中学习的技术来优化关键渲染路径并使这个页面尽可能快的渲染。

开始前,请导出这个代码库并检查代码。

指南

####Part 1: 优化 index.html 的 PageSpeed Insights 得分

以下是几个帮助你顺利开始本项目的提示:

  1. 将这个代码库导出
  2. 你可以运行一个本地服务器,以便在你的手机上检查这个站点
  $> cd /你的工程目录
  $> python -m SimpleHTTPServer 8080
  1. 打开浏览器,访问 localhost:8080
  2. 下载 ngrok 并将其安装在你的工程根目录下,让你的本地服务器能够被远程访问。
  $> cd /你的工程目录
  $> ./ngrok http 8080
  1. 复制ngrok提供给你的公共URL,然后尝试通过PageSpeed Insights访问它吧!可选阅读:更多关于整合ngrok、Grunt和PageSpeed的信息

接下来,你可以一遍又一遍的进行配置、优化、检测了!祝你好运!


####Part 2: 优化 pizza.html 的 FPS(每秒帧数)

你需要编辑 views/js/main.js 来优化 views/pizza.html,直到这个网页的 FPS 达到或超过 60fps。你会在 main.js 中找到一些对此有帮助的注释。

你可以在 Chrome 开发者工具帮助中找到关于 FPS 计数器和 HUD 显示的有用信息。Chrome 开发者工具帮助.

一些关于优化的提示与诀窍

使用 Bootstrap 并定制样式

这个项目基于 Twitter 旗下的 Bootstrap框架 制作。所有的定制样式都在项目代码库的 dist/css/portfolio.css 中。

优化过程

  • 图片压缩,压缩了最大的那张图片
  • css媒体查询
  • font用js异步加载
  • script链接用async,也放到页面最下面
  • style.css用内联
  • main.js中有两处循环里访问了offsetWidth属性,拿到循环外部
  • jquerySelector换成getElementById
  • pizza的数量改成自动计算的

test01's People

Contributors

yangyingwx avatar

Watchers

James Cloos 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.