Black Lives Matter. Please consider donating to Black Girls Code today.

Plotly Dash PWA

I’m currently working on a project that aims to add Progressive Web App functionality to Plotly Dash and so far I haven’t had much headway with it.

This is how far I’ve come:
I have a service worker JS file that can cache scripts and CSS files. I placed the service-worker.js file in dash_core_components/site-packages you can see in (lines 12-23) how I was able to include them as scripts. The PWA functionality caches scripts and stylesheets (as seen in the service-worker.js filesToCache array) just fine, but I can’t cache the ‘/’ route which is where the layout renders.

Do you have any suggestions on how to cache the layout so that it renders offline (with full functionality) as well? I am testing this on my local machine for now.

The code’s here: