- AMP:Building Accelerated Mobile Pages
- Ruadhan O'Donoghue
- 208字
- 2021-07-08 10:03:58
Optimizations that make AMP fast
- JavaScript: All JavaScript is loaded asynchronously and is non-blocking. No user JavaScript is allowed in the main page (although you can include JavaScript in iframes that can't block the main page render).
- Static resource sizing: External resources such as images, videos, and ads must specify their sizes statically. This means that AMP can calculate the position of all elements and page layout before anything is downloaded.
- CSS inlining and limitations: CSS must be inlined in the head of the AMP page and is limited to 50 KB per page. Some CSS is restricted, including the * selector, the not selector, the filter property, and the !important declaration. Only GPU-accelerated CSS animations and transitions are permitted. If the GPU can't handle an effect, then the browser must perform the required computation instead, slowing down the page render. Specifically, only transform and opacity properties can be animated.
- Web fonts: Web fonts can only be loaded from white-listed providers.
- Optimized resource loading: AMP takes control of resource downloading from the browser. Only items that are above-the-fold, or that are likely to be seen by the user, are fetched.
- Efficient pre-rendering: When possible, AMP pages are pre-rendered in the background. This is where things get really interesting!
推薦閱讀
- Python概率統(tǒng)計
- Raspberry Pi Networking Cookbook(Second Edition)
- Learning AWS Lumberyard Game Development
- 零基礎(chǔ)入門學(xué)習(xí)Python
- Microsoft Azure Storage Essentials
- JavaScript應(yīng)用開發(fā)實(shí)踐指南
- .NET 4.5 Parallel Extensions Cookbook
- SQL Server 2008中文版項(xiàng)目教程(第3版)
- C語言程序設(shè)計實(shí)踐
- Node.js實(shí)戰(zhàn):分布式系統(tǒng)中的后端服務(wù)開發(fā)
- 計算機(jī)應(yīng)用基礎(chǔ)(Windows 7+Office 2010)
- 小學(xué)生C++趣味編程從入門到精通
- Hands-On ROS for Robotics Programming
- Linux Networking Cookbook
- JavaScript高級程序設(shè)計(第4版)