- 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!
推薦閱讀
- DBA攻堅指南:左手Oracle,右手MySQL
- 程序員修煉之道:程序設計入門30講
- 大學計算機應用基礎實踐教程
- 深入淺出Java虛擬機:JVM原理與實戰
- 人人都懂設計模式:從生活中領悟設計模式(Python實現)
- Kotlin編程實戰:創建優雅、富于表現力和高性能的JVM與Android應用程序
- 微服務架構深度解析:原理、實踐與進階
- Oracle實用教程
- Tableau Desktop可視化高級應用
- jQuery從入門到精通(微課精編版)
- Java多線程并發體系實戰(微課視頻版)
- Java EE 7 Development with WildFly
- Mastering Unity 2017 Game Development with C#(Second Edition)
- Python自動化運維:技術與最佳實踐
- Java EE應用開發及實訓