Skip to content

Commit

Permalink
fix(gatsby-plugin-offline): Sync docs with actual defaults being used (
Browse files Browse the repository at this point in the history
…#9903)

I've noticed the Readme of gatsby-plugin-offline is out of sync with the actual defaults from its gatsby-node.js.

This commit fixes this by copying the options object from gatsby/packages/gatsby-plugin-offline/src/gatsby-node.js into this Readme.
  • Loading branch information
ubergesundheit authored and pieh committed Nov 13, 2018
1 parent 3005954 commit 8cd7432
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/gatsby-plugin-offline/README.md
Expand Up @@ -33,12 +33,11 @@ const options = {
globDirectory: rootDir,
globPatterns,
modifyUrlPrefix: {
rootDir: ``,
// If `pathPrefix` is configured by user, we should replace
// the default prefix with `pathPrefix`.
"": args.pathPrefix || ``,
"/": `${pathPrefix}/`,
},
navigateFallback: `/offline-plugin-app-shell-fallback/index.html`,
navigateFallback: `${pathPrefix}/offline-plugin-app-shell-fallback/index.html`,
// Only match URLs without extensions or the query `no-cache=1`.
// So example.com/about/ will pass but
// example.com/about/?no-cache=1 and
Expand All @@ -47,17 +46,22 @@ const options = {
// URLs and not any files hosted on the site.
//
// Regex based on http://stackoverflow.com/a/18017805
navigateFallbackWhitelist: [/^[^?]*([^.?]{5}|\.html)(\?.*)?$/],
navigateFallbackWhitelist: [/^([^.?]*|[^?]*\.([^.?]{5,}|html))(\?.*)?$/],
navigateFallbackBlacklist: [/\?(.+&)?no-cache=1$/],
cacheId: `gatsby-plugin-offline`,
// Don't cache-bust JS files and anything in the static directory
dontCacheBustUrlsMatching: /(.*js$|\/static\/)/,
// Don't cache-bust JS or CSS files, and anything in the static directory
dontCacheBustUrlsMatching: /(.*\.js$|.*\.css$|\/static\/)/,
runtimeCaching: [
{
// Add runtime caching of various page resources.
urlPattern: /\.(?:png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/,
handler: `staleWhileRevalidate`,
},
{
// Use the Network First handler for external resources
urlPattern: /^https?:/,
handler: `networkFirst`,
},
],
skipWaiting: true,
clientsClaim: true,
Expand Down

0 comments on commit 8cd7432

Please sign in to comment.