Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Service worker #13

Merged
merged 4 commits into from
Jun 25, 2018
Merged

Service worker #13

merged 4 commits into from
Jun 25, 2018

Conversation

trys
Copy link
Contributor

@trys trys commented Jun 25, 2018

I've modified a Service Worker I've used before on static sites. It's network-first, cache-fallback so it'll work offline, but still get instant content updates without breaking Netlify's cache invalidation. Given all assets are inlined at this stage, this method works well. The main downside is that shaky network conditions will still affect this site, but as it's only html for now, it's not a big deal.

There's a new offline page that lists the key pages. I've also added a trailing slash to the footer links. Netlify auto-redirects /code-of-conduct to /code-of-conduct/ so that would count as separate URLs in the service worker. Plus skipping the redirect will improve performance.

Future ideas for the SW could include:

  • Dedicated image cache
  • Cache trimming
  • Form submit prevention
  • Cache-first strategy for non-html assets

@trys
Copy link
Contributor Author

trys commented Jun 25, 2018

Not getting 100% PWA lighthouse scores, but that may be related to this issue: GoogleChrome/lighthouse#4541

The start_url is present, but it's claiming it's unusable. I'm beginning to think this is a manifest.json issue, though it's unclear at this point.

@alexcarpenter alexcarpenter merged commit d5f0a2a into alexcarpenter:master Jun 25, 2018
@alexcarpenter
Copy link
Owner

@trys 👏🏻👏🏻👏🏻

@alexcarpenter alexcarpenter mentioned this pull request Jun 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants