lavas-project / jekyll-pwa

Jekyll plugin for PWA
MIT License
107 stars 19 forks source link

Please check my installation #30

Open bsde1245 opened 5 years ago

bsde1245 commented 5 years ago

Hi, Thanks for this plugin. I am a newbie. I tried to add this plugin in my website here. Repo is this. I can't see the pwa notification. Which step I am missing.

souldanger commented 5 years ago

Hello best to use the Chrome console/dev tools in order to see if the script is loading. You'll also see that your website produces a few 404's... As far as I can see, the script is not loading on your website.

bsde1245 commented 5 years ago

Which script should I look for? Those 404's can be fixed by adding, {{site.baseurl}}. But is that enough?

bsde1245 commented 5 years ago

Locally I get

workbox Welcome to Workbox! /assets/js/workbox-v3.6.3/workbox-core.dev.js:132:21
workbox Precaching is responding to: / /assets/js/workbox-v3.6.3/workbox-core.dev.js:132:21
workbox Precaching is responding to: /js/footer.js /assets/js/workbox-v3.6.3/workbox-core.dev.js:132:21
workbox Welcome to Workbox! workbox-core.dev.js:132:21
workbox Precaching 0 files. 9 files are already cached. workbox-core.dev.js:132:21

in console. But in site I can't see this.

souldanger commented 5 years ago

perfect! You can only see this in dev mode but not when live - this is intentional! This means its working perfectly fine. Now when you open the website on your mobile device, it'll ask you to install it and the icon as defined in your manifest will appear on your home screen.

bsde1245 commented 5 years ago

But in my site here I get Service worker is not registered or does not control the Start URL in Application tab of console. I can access https://forumkeralam.ml/service-worker.js but can't access https://forumkeralam.ml/assets/js/workbox-v3.6.3/workbox-sw.js or https://forumkeralam.ml/assets/js/workbox-v3.6.2/workbox-sw.js

bsde1245 commented 5 years ago

Locally in http://localhost:4000/service-worker.js I have

                        importScripts("/assets/js/workbox-v3.6.3/workbox-sw.js");
            workbox.setConfig({modulePathPrefix: "/assets/js/workbox-v3.6.3"});

            self.__precacheManifest = [{"url":"/js/footer.js","revision":"b3f41834b1eb54df1a50d30c2bde6556"},{"url":"/js/lunr.min.js","revision":"57fc8edbd9ac8ed0e94dbfca3f722ea8"},{"url":"/js/search.js","revision":"8043965b6a3727e172b7b4b7f03a4bc0"},{"url":"/index.html","revision":"cfbd3aa3bf6a70aa35cf8c085f6b4c04"},{"url":"/howto/2016/12/28/How-to-download-wikipedia-and-use-offline.html","revision":"16aaca7174ea6c0fb20e7258f6898432"},{"url":"/howto/2016/12/08/how-to-type-malayalam-in-android-phone-easily.html","revision":"f648f26613ff54d460b07daf4b7bfa83"},{"url":"/howto/2016/11/23/how-to-download-videos-from-youtube-without-any-software-easily.html","revision":"7e006a4803d1cb44f4a40e09d11bbb84"},{"url":"/howto/2016/11/17/How-to-download-softwares-and-movies-files-from-torrent-sites.html","revision":"69c43b33d24b9d54c3202c1cccf7a94b"},{"url":"/howto/2016/11/16/How-to-take-screenshot-of-monitor-screen.html","revision":"6d4bc63c8dde28e06a3dacc8505f24e2"}];

            workbox.core.setCacheNameDetails({
    prefix: 'xiaop-blog',
    suffix: 'v1',
    precache: 'precache',
    runtime: 'runtime-cache'
});

workbox.skipWaiting();
workbox.clientsClaim();

workbox.precaching.precacheAndRoute(self.__precacheManifest);

workbox.routing.registerRoute(
    /\.html$/,
    workbox.strategies.networkFirst()
);

workbox.routing.registerRoute(
    /assets\/(img|icons)/,
    workbox.strategies.cacheFirst()
);

workbox.routing.registerRoute(
    /^https?:\/\/cloud.netlifyusercontent.com/,
    workbox.strategies.staleWhileRevalidate()
);

workbox.routing.registerRoute(
    /^https?:\/\/cdn.staticfile.org/,
    workbox.strategies.staleWhileRevalidate()
);

workbox.routing.registerRoute(
    /^https?:\/\/at.alicdn.com/,
    workbox.strategies.staleWhileRevalidate()
);

But on site in https://forumkeralam.ml/service-worker.js I have

workbox.core.setCacheNameDetails({
    prefix: 'xiaop-blog',
    suffix: 'v1',
    precache: 'precache',
    runtime: 'runtime-cache'
});

workbox.skipWaiting();
workbox.clientsClaim();

workbox.precaching.precacheAndRoute(self.__precacheManifest);

workbox.routing.registerRoute(
    /\.html$/,
    workbox.strategies.networkFirst()
);

workbox.routing.registerRoute(
    /assets\/(img|icons)/,
    workbox.strategies.cacheFirst()
);

workbox.routing.registerRoute(
    /^https?:\/\/cloud.netlifyusercontent.com/,
    workbox.strategies.staleWhileRevalidate()
);

workbox.routing.registerRoute(
    /^https?:\/\/cdn.staticfile.org/,
    workbox.strategies.staleWhileRevalidate()
);

workbox.routing.registerRoute(
    /^https?:\/\/at.alicdn.com/,
    workbox.strategies.staleWhileRevalidate()
);

It is working locally, but on github pages it not works :(

souldanger commented 5 years ago

looks like the gem doesn't work when you deploy your site. check your build/deploy procedures.

bsde1245 commented 5 years ago

I issued following commands git add . git commit -am "update" git push origin gh-pages

souldanger commented 5 years ago

Sorry, I don't use gh-pages, so can't help...

bsde1245 commented 5 years ago

Okey, Thanks for the support

bsde1245 commented 5 years ago

I think there is a bug with gem version 2.2.2, script is looking for the folder workbox-v3.6.2 but the real folder exists is workbox-v3.6.3. And for some reason gem version 2.2.3 is not working with gh-pages.

souldanger commented 5 years ago

Don't worry, the Workbox files are stored with the gem, so this can't be the issue. do you get any feedback from gh pages as described here: https://help.github.com/en/articles/troubleshooting-github-pages-builds

bsde1245 commented 5 years ago

I don't have any build errors with my repo. It was a success

souldanger commented 5 years ago

hmmm, in which case the gem should work. I would recommend to check gh pages help docs. There's a good chance that gh-pages only allows certain gems...

bsde1245 commented 5 years ago

Ohhh! That may be the issue. Thanks for pointing that.