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

amp to pwa #1

Merged
merged 6 commits into from Feb 17, 2019
Merged
Diff settings

Always

Just for now

fix(amp): Install serviceworker

  • Loading branch information...
tomoyukikashiro committed Feb 16, 2019
commit c26c038e71162394118f0e4d4635c1c7d22da76d
Copy path View file
@@ -112,7 +112,12 @@ module.exports = {
options: {
files: ['posts/**/index.html', 'index.html'],
gaConfigPath: 'gaConfig.json',
dist: 'public/amp'
dist: 'public/amp',
serviceWorker: {
src: 'https://gatsby-starter-blog-demo.netlify.com/sw.js',
'data-iframe-src': 'https://gatsby-starter-blog-demo.netlify.com/amp-install-serviceworker.html',
layout: 'nodisplay'
}
}
},
`gatsby-plugin-offline`,
@@ -0,0 +1,17 @@
<!doctype html>
<html>
<head>
<title>installing service worker</title>
<script type="text/javascript">
var swsource = 'https://gatsby-starter-blog-demo.netlify.com/sw.js';
if("serviceWorker" in navigator) {
navigator.serviceWorker.register(swsource).then(function(reg){
console.log('ServiceWorker scope: ', reg.scope);
}).catch(function(err) {
console.log('ServiceWorker registration failed: ', err);
});
};
</script>
</head>
<body></body>
</html>
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.