The Front-End Checklist
做个记录,摘自Front-End Performance Checklist
HTML
- Minified HTML:
The HTML code is minified, comments, white spaces and new lines are removed from production files.
- Remove unnecessary comments:
Ensure that comments are removed from your pages.
- Remove unnecessary attributes:
Type attributes like
type="text/javascript"ortype="text/css"are not required anymore and should be removed. - Place CSS tags always before JavaScript tags:
Ensure that your CSS is always loaded before having JavaScript code.
- Minimize the number of iframes:
Use iframes only if you don't have any other technical possibility. Try to avoid as much as you can iframes.
CSS
- Minification:
All CSS files are minified, comments, white spaces and new lines are removed from production files.
- Concatenation:
CSS files are concatenated in a single file (Not always valid for HTTP/2).(合并css,减少http请求,http2不必)
- Non-blocking:
CSS files need to be non-blocking to prevent the DOM from taking time to load.(css必须是非阻塞的)
How:You need to add therelattribute with thepreloadvalue and addas="style"on the<link>element<link rel="preload" href="a.css" as="style" onload="this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="a.css"></noscript> - Length of CSS classes:
The length of your classes can have an (slight) impact on your HTML and CSS files (eventually).
- Unused CSS:
Remove unused CSS selectors.
- CSS Critical:
The CSS critical (or "above the fold") collects all the CSS used to render the visible portion of the page. It is embedded before your principal CSS call and between
<style></style>in a single line (minified if possible).
取出首屏渲染所必须的 critical CSS,以内联的方式写在 <style></style> 之中,然后异步加载剩余的 CSS 样式,这相当于离线加载剩余部分的 CSS 样式,然后在后台将其注入到页面中。 - Embedded or inline CSS:
Avoid using embed or inline CSS inside your
<body>(Not valid for HTTP/2) - Analyse stylesheets complexity:
Analyzing your stylesheets can help you to flag issues, redundancies and duplicate CSS selectors.
分析样式表,去除冗余重复的代码
Fonts
- Webfont formats:
You are using WOFF2 on your web project or application.
- Use
preconnectto load your fonts faster:<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- Webfont size:
Webfont sizes don't exceed 300kb (all variants included)
- Prevent Flash or Invisible Text:
Avoid transparent text until the Webfont is loaded
Images
- Images optimization:
Your images are optimized, compressed without direct impact to the end user.
- Images format:
Choose your image format appropriately.
- Use vector image vs raster/bitmap:
Prefer using vector image rather than bitmap images (when possible).
矢量图像(SVG)往往比图像小,SVG的响应速度和比例都很好 - Images dimensions:
Set
widthandheightattributes on<img>if the final rendered image size is known. - Avoid using Base64 images:
You could eventually convert tiny images to base64 but it's actually not the best practice.
- Lazy loading:
Images are lazyloaded (A noscript fallback is always provided).
- Responsive images:
Ensure to serve images that are close to your display size.(
srcset和picture了解一下)
JavaScript
- JS Minification:
All JavaScript files are minified, comments, white spaces and new lines are removed from production files (still valid if using HTTP/2).
- No JavaScript inside:
(Only valid for website) Avoid having multiple JavaScript codes embedded in the middle of your body. Regroup your JavaScript code inside external files or eventually in the
<head>or at the end of your page (before</body>). - Non-blocking JavaScript:
JavaScript files are loaded asynchronously using
asyncor deferred usingdeferattribute. - Optimized and updated JS libraries:
All JavaScript libraries used in your project are necessary (prefer Vanilla JavaScript for simple functionalities), updated to their latest version and don't overwhelm your JavaScript with unnecessary methods.
- Check dependencies size limit:
Ensure to use wisely external libraries, most of the time, you can use a lighter library for a same functionality.(比如dayjs替代了momentjs)
- JavaScript Profiling:
Check for performance problems in your JavaScript files (and CSS too).
Server
- Page weight < 1500 KB (ideally < 500 KB):
Reduce the size of your page + resources as much as you can.
- Page load times < 3 seconds:
Reduce as much as possible your page load times to quickly deliver your content to your users.
- Time To First Byte < 1.3 seconds:
Reduce as much as you can the time your browser waits before receiving data.
- Cookie size:
If you are using cookies be sure each cookie doesn't exceed 4096 bytes(4kb) and your domain name doesn't have more than 20 cookies.
- Minimizing HTTP requests:
Always ensure that every file requested are essential for your website or application.
- Use a CDN to deliver your assets:
Use a CDN to deliver faster your content over the world.
- Serve files from the same protocol:
Avoid having your website using HTTPS and serve files coming from source using HTTP.
- Serve reachable files:
Avoid requesting unreachable files (404).
- Set HTTP cache headers properly:
Set HTTP headers to avoid expensive number of roundtrips between your browser and the server.
- GZIP / Brotli compression is enabled:
The Front-End Checklist的更多相关文章
- Security Checklist (路由器安全checklist)
Security Checklist Website by Michael Horowitz Home | Introduction | Router Bugs | Security Che ...
- Java Web项目报错java.lang.NullPointerException at org.apache.jsp.front.index_jsp._jspInit(index_jsp.java:30)
环境:myeclipse+tomcat6+jdk6 今天搭建了一个Java Web项目,访问index.jsp时报如下错误: 严重: Servlet.service() for servlet jsp ...
- Front End Developer Questions 前端开发人员问题(二)CSS 后续
问题来源:http://markyun.github.io/2015/Front-end-Developer-Questions/ 31.视差滚动效果,如何给每页做不同的动画?(回到顶部,向下滑动要再 ...
- 企业管理咨询Interview Checklist
企业管理咨询Interview Checklist 一. 企业战略 1. 您对公司所处行业的看法如何? 2. 请您介绍一下公司的发展历程,主要业务开展状况及核心竞争力.关键成功因素有哪些? 3. 在您 ...
- I finally made sense of front end build tools. You can, too.
来源于:https://medium.freecodecamp.com/making-sense-of-front-end-build-tools-3a1b3a87043b#.nvnd2vsd8 ...
- H3C汇聚层交换机认证在线人数展示系统之CheckList和燃尽图(16/04/06-16/04/13)
一.CheckList(核查表) 序号 事件 计划完成时间 实际完成时间 未延迟 未完成 完成 1 登录口令加密以及解密 16/04/06 16/04/06 Y 2 表的创建和IP以及口令 ...
- [front]有效开展一个前端项目
今天的前端如果没有用到 npm,效率是比较低的:所以要从使用的工具来讲. 1. 一切都依赖于 nodejs: 下载一个 linux 的源码包就可以开始安装了. $ wget https://nodej ...
- [software development] 需求分析checklist
[software development] 需求分析checklist // */ // ]]> [software development] 需求分析checklist Table of ...
- Queue的push和front操作
#include <queue> #include <cstdlib> using namespace std; int main(){ queue<int> qu ...
- 自己动手做Web框架—MVC+Front Controller
在我前面一篇博文<逃脱Asp.Net MVC框架的枷锁,使用Razor视图引擎>发表之后,很多人关心,脱离了之后怎么办?那么这可以说是它的续篇了. 同时,这也是eLiteWeb开源软件的一 ...
随机推荐
- hdu 6201 transaction transaction transaction
https://vjudge.net/contest/184514#problem/H 题意: 一个商人为了赚钱,在城市之间倒卖商品.有n个城市,每个城市之间有且只有一条无向边连通.给出n个城市的货物 ...
- VS2010的快捷键;VS2012变化的快捷键
注释::VS2010是(Ctrl+E,C),VS2012是(Ctrl+K, Ctrl+C),实际操作,按住Ctrl键不放,先按K键,再按C键.相当于Ctrl+K加 Ctrl+C的组合键 反註解:VS2 ...
- 全局监听SCREEN_ON和SCREEN_OFF的替代方法--监听屏幕解锁事件
在做一个程序的时候,需要时刻保持某一服务是启动的,因此想到了通过监听屏幕SCREEN_ON和SCREEN_OFF这两个action.奇怪的是,这两个action只能通过代码的形式注册,才能被监听到,使 ...
- Linux服务器---mysql忘记root密码
忘记root密码 如果不小心忘记了root密码,那么mysql就不能再登录了,这时就要重置root密码才行.通过下面的步骤,我们可以重新设置root密码. 1.退出mysql [root@localh ...
- svn忽略目录,svn忽略app目录add toignore list,避免每次更新很多app的内容下来导出到本地很麻烦
svn忽略目录,svn忽略app目录add toignore list,避免每次更新很多app的内容下来导出到本地很麻烦 ------------------------------ 本人微信公众帐号 ...
- MATERIALIZED VIEW-物化视图
Oracle的实体化视图提供了强大的功能,可以用在不同的环境中,实体化视图和表一样可以直接进行查询.实体化视图可以基于分区表,实体化视图本身也可以分区. 主要用于预先计算并保存表连接或聚集等耗时较多 ...
- Java高并发高性能分布式框架从无到有微服务架构设计
微服务架构模式(Microservice Architect Pattern).近两年在服务的疯狂增长与云计算技术的进步,让微服务架构受到重点关注 微服务架构是一种架构模式,它提倡将单一应用程序划分成 ...
- mysql主备部署[高可用]
配置方案 master:192.168.99.61 service-id:61 slave:192.168.99.62 service-id:62同步账号:sync 同步密码:sync 主:192 ...
- 20145307陈俊达《网络对抗》Exp5 MSF基础应用
20145307陈俊达<网络对抗>Exp5 MSF基础应用 基础问题回答 用自己的话解释什么是exploit,payload,encode? exploit就相当于是载具,各式各样的漏洞在 ...
- 20145212罗天晨 注入shellcode实验及Retuen-to-libc实验
注入shellcode实验 实验步骤 一.准备一段shellcode 二.设置环境 Bof攻击防御技术 1.从防止注入的角度来看:在编译时,编译器在每次函数调用前后都加入一定的代码,用来设置和检测堆栈 ...