Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Production-ready Progressive Web Apps

Production-ready Progressive Web Apps

Clay Liao

May 13, 2017
Tweet

More Decks by Clay Liao

Other Decks in Technology

Transcript

  1. Production-ready Progressive Web Apps Ying Hsiang Liao Ads Solutions Consultant,

    Google 苏宁前端技术交流论坛 | May 13, 2017
  2. Proprietary + Confidential The Web offers great discovery, but engagement

    is low Source: comScore Mobile Metrix, U.S., Age 18+, June 2016 9.3 Monthly unique visitors (MM) 4.0 Average minutes per visitor Mobile web Apps 11.4 188.6
  3. Proprietary + Confidential The web has always been great at

    distribution Engagement Discovery Mobile web Apps
  4. Proprietary + Confidential Mobile web has some challenges Limited access

    to device capabilities 1 2 3 4 Pages and sites take too long to load Ads is slow Filling out forms takes too long
  5. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis

    non erat sem Proprietary + Confidential 购物体验从搜索开始 挑选喜欢的款式
  6. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis

    non erat sem Proprietary + Confidential 等待库存更新 要求被通知 商品暂时缺货
  7. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis

    non erat sem Proprietary + Confidential 有的时候信号不佳 即使在没有信号的情况下 仍可以浏览网页
  8. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis

    non erat sem Proprietary + Confidential 收到电商的通知 加入购物车 付款 自动登录
  9. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis

    non erat sem Proprietary + Confidential 全屏打开 轻松付款 创建快捷图标 方便回访网站
  10. Proprietary + Confidential Alibaba • 76% higher conversions across browsers

    • 14% more monthly active users on iOS; 30% on Android • 4X higher interaction rate from Add to Homescreen Showcase
  11. Proprietary + Confidential Enable reliable experiences with Service Worker 旧模式

    After Service worker Client side proxy written in JavaScript 安装在用户端 Web server SW cache Web server Local cache Before
  12. Proprietary + Confidential Progressive Web App Checklist • Lighthouse ◦

    Chrome Extension ◦ Install and run the Node command line tool ◦ Run the Node module programmatically ◦ Integrate with continuous integration / delivery process • Test on real device, real network
  13. Proprietary + Confidential Debug Service Workers • Inspecting the Manifest

    • Inspecting the Service Workers ◦ Offline ◦ Update on reload ◦ Bypass for network ◦ Show all service workers • Exploring the cache • Inspecting Cache Storage • Cleaning the slate
  14. Proprietary + Confidential The Challenges • What about edit on

    index.html? • What about /scripts/app-abcd1234.js? • What about new-image.png?
  15. Proprietary + Confidential Maintainable Service Workers • Asset Manifest ◦

    Precache based on a list of files generated at build time. • Runtime Cleanup ◦ Use an expiration policy to keep runtime caches fresh and clean.
  16. Proprietary + Confidential Service Worker Libraries • sw-precache • sw-toolbox

    • sw-offline-google-analytics sw-precache sw-toolbox sw-offline-ga
  17. Proprietary + Confidential sw-precache Source: Lorem ipsum dolor sit amet,

    consectetur adipiscing elit. Duis non erat sem Build-time precaching for static assets https://github.com/GoogleChrome/sw-precache package.json “Scripts”: { “Precache”: “sw-precache --root=’build/’” } $ npm run precache
  18. Proprietary + Confidential Web Starter Kit Opinionated boilerplate for web

    development. • Responsive boilerplate • Sass support • Performance optimization • Code Linting • ES2015 via Babel 6.0 • Built-in HTTP Server • Live Browser Reloading • Cross-device Synchronization • Offline support • PageSpeed Insights https://developers.google.com/web/tools/starter-kit/
  19. Proprietary + Confidential Indexable Progressive Web Apps • Make Your

    Content Crawlable • Provide Clean URLs • Specify Canonical URLs • Design for Multiple Devices • Use Progressive Enhancement Devices • Test with Search Console • Annotate with Schema.org structured data https://webmasters.googleblog.com/2016/11/building-indexable-progressive-web-apps.html