Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update pwa.yaml to reflect 1.1.x changes #15

Open
tacman opened this issue Mar 18, 2024 · 0 comments
Open

update pwa.yaml to reflect 1.1.x changes #15

tacman opened this issue Mar 18, 2024 · 0 comments

Comments

@tacman
Copy link
Contributor

tacman commented Mar 18, 2024

The pwa.yaml file should be updated to reflect the changes in 1.1.x:

  • regex->match_callback
  • urls->preload_urls
  • page_caches -> resource_caches
  • strategies now begin with a capital letter

Something like this:

        workbox:
            # https://pwa.spomky-labs.com/the-service-worker/workbox/warm-caching-1
            resource_caches:
                  - cache_name: page_cache
                    match_callback: 'regex: |/$|'
                    strategy: 'StaleWhileRevalidate'
                    broadcast: true
                    broadcast_headers:
                        - 'X-App-Cache'
                    preload_urls:
                    - 'app_homepage'
                  - cache_name: pages
                    match_callback: 'regex: |/api/.*$|'
#                    regex: "/api"
                    strategy: CacheFirst
                    broadcast: true
                    broadcast_headers:
                        - 'X-App-Cache'
            offline_fallback:
                page: 'app_homepage'
            background_sync:
                - queue_name: 'items'
                  match_callback: 'regex: {/items/.*$}'
                  broadcast_channel: 'items-sync'
                - queue_name: 'add'
                  match_callback: 'regex: |/add|'
                  method: POST
                  broadcast_channel: 'add-item'

I used pipes and brackets in the regex as I find it easier to read than

'regex: \/articles\/.*$'
'regex: {/articles/.*$}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant