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

PWWA: Progressive WordPress Web App

Andriy
September 12, 2018

PWWA: Progressive WordPress Web App

Un case study sullo sviluppo di Progressive Web App (PWA) con WordPress. Esempi e best practices su come creare temi offline-first e come aggiungere funzionalità delle PWA a temi esistenti.

Andriy

September 12, 2018
Tweet

More Decks by Andriy

Other Decks in Programming

Transcript

  1. PWWA
    Progressive WordPress Web App
    WP Meetup Milano
    11/09/2018
    Andriy Frankevych

    View Slide

  2. Andriy Frankevych
    ● Back end web developer @ facile.it
    ● @alsoknownasdrew on GitHub, Twitter, Telegram etc...
    ● 3+ years of experience with WordPress
    ● https://t.me/webdevhub

    View Slide

  3. What is a PWA?

    View Slide

  4. PWA ARE:
    Reliable
    ● Load instantly
    ● No downasaur even when offline
    Fast
    ● Respond quickly to user interactions
    ● Smooth animations
    ● No janky transitions
    Try them on https://pwa.rocks/
    Engaging:
    ● Home screen launch
    ● Full screen experience
    ● Access to native features like push
    notifications, payments API(full list on
    https://whatwebcando.today/)

    View Slide

  5. PWA are reliable

    View Slide

  6. 53%
    of users will abandon your website if it takes longer than 3 seconds to load
    (Google DoubleClick Blog)

    View Slide

  7. One of the most popular WP theme metrics

    View Slide

  8. Minify and concatenate your assets

    View Slide

  9. Deregister everything!

    View Slide

  10. Inline critical CSS and load the rest later

    View Slide

  11. Inline critical CSS (lazy way)

    View Slide

  12. Inline critical CSS

    View Slide

  13. Use system font stack

    View Slide

  14. Offline first

    View Slide

  15. Service Worker
    ● Javascript file executed on a separate thread
    ● Acts like a proxy between your client(browser) and network
    ● Can intercept fetch events
    ● Have access to IndexedDB and Cache API

    View Slide

  16. Service Worker Registration

    View Slide

  17. Service Worker Installation

    View Slide

  18. Fetch event interception

    View Slide

  19. Cache API Access

    View Slide

  20. Retrieving from cache

    View Slide

  21. Google Workbox
    https://developers.google.com/web/tools/workbox/

    View Slide

  22. Offline homepage

    View Slide

  23. PWA are fast

    View Slide

  24. Barba.js

    View Slide

  25. PWA are engaging

    View Slide

  26. Launch from home screen

    View Slide

  27. Manifest.json

    View Slide

  28. ...

    View Slide

  29. A2HS Requirements
    ● The web app is not already installed
    ● The user has interacted with the domain for at least 30 seconds
    ● Includes a web app manifest that includes
    ● Served over HTTPS (required for service workers)
    ● Has registered a service worker with a fetch event handler

    View Slide

  30. A2HS Handler

    View Slide

  31. PWA are
    Reliable:
    ● Fast load and first contentful and meaningful paint
    ● Website responds with status 200 when offline
    Fast:
    ● Client side Ajax routing
    ● Content transitions and animations on user interaction
    Engaging:
    ● A2HS prompt
    ● Lunch from home and standalone fullscreen experience

    View Slide

  32. Thanks!
    Resources:
    ● _S: https://underscores.me/
    ● Gulp.js: https://gulpjs.com/
    ● loadCSS: https://github.com/filamentgroup/loadCSS
    ● Lighthouse: https://developers.google.com/web/tools/lighthouse/
    ● Workbox: https://developers.google.com/web/tools/workbox/
    ● Barba.js: http://barbajs.org/
    ● Favicon generator: https://realfavicongenerator.net/
    ● Firebase Web manifest generator: https://app-manifest.firebaseapp.com/

    View Slide