Skip to content

Commit

Permalink
Add Offline and Manifest plugin (gatsbyjs#687)
Browse files Browse the repository at this point in the history
* Preload components/data bundles for all links regardless of browser

Gatsby core won't have SW precaching built-in in the next release so
this is necessary for a fast site. And even if a browser is precaching
bundles, pulling bundles from the SW and evaling them still adds latency
to page transitions. Doing this work ahead of time in spare moments
means that page transitions will be always be fast.

* Remove offline-plugin

The webpack offline-plugin is great but it doesn't work with content not
handled by Webpack as Gatsby is increasingly moving towards.

Also by handling this in plugins instead of core, it'll offer users more
choices about how to handle "offline" than trying to meet all needs in
core.

* Revert gatsby-link change

Overly expensive for pages with lots of links.

* This error isn't helpful. Perhaps make configurable for some APIs

* Add gatsby-plugin-offline

This adds a basic setup for handling loading a website with a service
worker generated by sw-precache. It uses the AppShell technique to load
first a simple HTML shell of the website (which would generally show the
header for most sites) which then loads the Javascript for the actual
page and renders that.

* Add gatsby-plugin-manifest — to simplify adding manifest.json to project

* Add required dependencies

* Add React as a dependency

* Remove unneeded dependency and fix function argument list

* Correct behavior for collecting pages from multiple plugins

* Correct absolute path to component

* Add plugins offfline/manifest to the GatsbyJS website

* Upgrade to latest canary + restore index.js

* Add plugins offline & manifest to gatsbygram

* Not being able to copy links from standalone display deal-breaker

* Address @jeffposnick's feedback

* Update sites to latest canary
  • Loading branch information
KyleAMathews authored Feb 22, 2017
1 parent bdc68bf commit 45b3627
Show file tree
Hide file tree
Showing 29 changed files with 3,815 additions and 243 deletions.
12 changes: 12 additions & 0 deletions examples/gatsbygram/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ module.exports = {
`gatsby-typegen-filesystem`,
`gatsby-typegen-sharp`,
`gatsby-plugin-glamor`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `GatsbyGram`,
short_name: `GatsbyGram`,
start_url: `/`,
background_color: `#f7f7f7`,
theme_color: `#191919`,
display: `minimal-ui`,
},
},
`gatsby-plugin-offline`,
{
resolve: `gatsby-plugin-google-analytics`,
options: {
Expand Down
22 changes: 12 additions & 10 deletions examples/gatsbygram/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
"version": "1.0.0",
"author": "Kyle Mathews <[email protected]>",
"dependencies": {
"gatsby": "1.0.0-alpha11",
"gatsby-link": "1.0.0-alpha11",
"gatsby-parser-json": "1.0.0-alpha11",
"gatsby-parser-sharp": "1.0.0-alpha11",
"gatsby-plugin-glamor": "1.0.0-alpha11",
"gatsby-plugin-google-analytics": "^1.0.0-alpha11-alpha.69d037ff",
"gatsby-plugin-sharp": "1.0.0-alpha11",
"gatsby-source-filesystem": "1.0.0-alpha11",
"gatsby-typegen-filesystem": "1.0.0-alpha11",
"gatsby-typegen-sharp": "1.0.0-alpha11",
"gatsby": "1.0.0-alpha12-alpha.70258e9c",
"gatsby-link": "1.0.0-alpha12-alpha.70258e9c",
"gatsby-parser-json": "1.0.0-alpha12-alpha.70258e9c",
"gatsby-parser-sharp": "1.0.0-alpha12-alpha.70258e9c",
"gatsby-plugin-glamor": "1.0.0-alpha12-alpha.70258e9c",
"gatsby-plugin-google-analytics": "^1.0.0-alpha12-alpha.70258e9c",
"gatsby-plugin-manifest": "1.0.0-alpha12-alpha.70258e9c",
"gatsby-plugin-offline": "1.0.0-alpha12-alpha.70258e9c",
"gatsby-plugin-sharp": "1.0.0-alpha12-alpha.70258e9c",
"gatsby-source-filesystem": "1.0.0-alpha12-alpha.70258e9c",
"gatsby-typegen-filesystem": "1.0.0-alpha12-alpha.70258e9c",
"gatsby-typegen-sharp": "1.0.0-alpha12-alpha.70258e9c",
"instagram-screen-scrape": "^2.0.0",
"lodash": "^4.16.4",
"mousetrap": "^1.6.0",
Expand Down
Loading

0 comments on commit 45b3627

Please sign in to comment.