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

Service worker caching, skeletal "offline mode" #212

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

stalgiag
Copy link
Collaborator

@stalgiag stalgiag commented Apr 22, 2024

This PR adds a caching library and workbox config. It constrains HTML loading to prevent the downloading of thousands of HTML files upon first visit. Future iterations on this work could explore manual handling of the HTML caching to allow for download of the full site offline with constraints upon resource usage. Right now this defaults to caching only visited pages and limits the cache to 50 html files.

This will cache any assets loaded into an iframe on Firefox and Safari but unfortunately, chromium does not allow caching via service worker or browser of any assets loaded into an iframe using the srcdoc attribute. Further work will be needed to employ a different strategy for the code frame.

In the interim, this PR speeds up site performance significantly.

Copy link
Collaborator

@outofambit outofambit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incredible

@stalgiag stalgiag merged commit 64be27a into main Apr 22, 2024
4 checks passed
@stalgiag stalgiag deleted the service-worker-caching branch April 22, 2024 19:42
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

Successfully merging this pull request may close these issues.

2 participants