Fireship · @fireship

Progressive Web Apps with Angular

Uploaded September 3, 2017 · Length 6:12

Progressive Web Apps with Angular

Summary

convert angular app to progressive web app with pwa spec and service worker

  • angular pwa
  • progressive web app
  • service worker
  • pwa spec
  • offline caching

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    a progressive web app or pwa will make

  2. 0:03

    a traditional web application behave

  3. 0:05

    more like a native mobile app

  4. 0:07

    in this episode we're going to take an

  5. 0:08

    angular 4 application and make it 100

  6. 0:11

    compliant with google's pwa spec

  7. 0:13

    to do this we're going to create an app

  8. 0:15

    manifest with a bunch of mobile icons

  9. 0:17

    we're going to cache our app offline

  10. 0:18

    with a service worker and we're going to

  11. 0:20

    serve it over a secure https connection

  12. 0:23

    when that's all said and done we'll be

  13. 0:25

    able to run our app through the

  14. 0:26

    lighthouse chrome plugin which is

  15. 0:28

    maintained by google

  16. 0:29

    which will tell us whether or not we're

  17. 0:31

    meeting all the pwa requirements as well

  18. 0:33

    as give us some feedback on performance

  19. 0:35

    and best practices

  20. 0:36

    not only will this provide a better user

  21. 0:38

    experience but it will also bring up

  22. 0:40

    this ad to home screen banner on

  23. 0:41

    android devices or any other program

  24. 0:44

    that supports progressive web apps

  25. 0:46

    currently it's not supported in ios

  26. 0:47

    safari or microsoft edge but they are

  27. 0:50

    moving in that direction so they

  28. 0:51

    probably will be supported in the future

  29. 0:53

    another cool feature we're not going to

  30. 0:54

    talk about in this video is push

  31. 0:56

    notifications but i do have another

  32. 0:58

    video covering that topic so make sure

  33. 0:59

    to check that out as well

  34. 1:01

    the first step is to install the

  35. 1:02

    lighthouse plugin for chrome you can get

  36. 1:04

    it in the chrome store

  37. 1:05

    and it's what we're going to use to

  38. 1:07

    generate the actual audit

  39. 1:09

    on the site the next step is to create

  40. 1:11

    the manifest.json file in the source

  41. 1:14

    directory of your project

  42. 1:15

    the purpose of this file is to tell

  43. 1:17

    browsers exactly how to handle your web

  44. 1:19

    app

  45. 1:20

    for example your app should have a name

  46. 1:22

    and some theme colors

  47. 1:24

    and you'll also want to tell it whether

  48. 1:25

    or not to display in portrait or

  49. 1:27

    landscape then we need to generate some

  50. 1:29

    icons there's plenty of places on the

  51. 1:31

    internet where you can have this all

  52. 1:32

    done automatically with just a single

  53. 1:34

    base

  54. 1:34

    logo you need to have a variety of icons

  55. 1:36

    to handle different mobile devices and

  56. 1:38

    operating systems

  57. 1:40

    after you generate the icons drop them

  58. 1:42

    into your assets folder in angular

  59. 1:44

    and then add them to the manifest each

  60. 1:46

    icon will need to have its own source

  61. 1:48

    size and type specified that's it for

  62. 1:51

    the manifest there's plenty of other

  63. 1:52

    things we could add here but this is the

  64. 1:54

    bare minimum that we need for now

  65. 1:56

    the next thing we need to do is link our

  66. 1:58

    manifest in the index.html as well as