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

Distill website into progressive webapp #435

Open
bes827 opened this issue Jan 14, 2022 · 0 comments
Open

Distill website into progressive webapp #435

bes827 opened this issue Jan 14, 2022 · 0 comments

Comments

@bes827
Copy link

bes827 commented Jan 14, 2022

Is there a way to convert a static distill website into PWA? I am much into web development but I like the fact that PWAs can be installed into smart phones home screen and can display in full screen plus other features (eg push notifications, etc..).

I read some online tutorials and understood that we need to add the following to the website root folder before deployment:

  • manifest.json and then link it in the index.html
  • serviceworker.js
  • app.js to register the service worker
  • folder with different icon sizes and splash screen

I followed the instructions from this example https://dev.to/phonerefer/convert-any-static-website-to-pwa-3fkb but could not get it to work.

Is there a built in way in the distill package to make PWA? or is there a tutorial / github repo with an example that I can follow?

thank you

Update:
I was able to generate a progressive webapp from distill website by:

  • adding service worker, manifest files and icons folder to the root directory (I found this example extremely helpful https://github.com/aladin002dz/PWA)
  • adding this script to the head section of index.html
<link rel="manifest" href="manifest.json">
    <script>
        //if browser support service worker
        if('serviceWorker' in navigator) {
          navigator.serviceWorker.register('sw.js');
        };
      </script>

The problem is that the script won't persist in index.html if it is regenerated and I will have to manually add it every time. Is there a way to "inject" the script using a function that I can run after I render the site?

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