forked from gatsbyjs/gatsby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.0] optimizations around prefetching page resources (gatsbyjs#1133)
* Copy cache-dir files into site's .cache * Got new loader/componentrenderer working in development * Use ComponentRenderer for rendering * On demand loading of async page resources working for prod builds * Use script loader so loading scripts don't block rendering * Add gatsby-module-loader to replace bundle-loader to add ability to delay executing scripts after loading * Split out loading/executing resources into functions * Add prefetcher * changing order to see if it fixes not removing event handler * Just don't have a loader for now * Updates to service worker plugin * Add tests for find-page + make it work with prefixed links * Proritize links that mount first i.e. are higher on the page * Wait for all links to mount before fetching so resource count is correct * Add plop template for adding new example sites * Add plugin for nprogress to auto show when page loading is delayed * Don't break layout if there's no content * Log at end of build how long build took * Not using this package * Remove logging + run format * Add the nprogress plugin * Fix some emitter code * Make it easy to override the default color of the nprogress bar * Fix check on variable * Fix prefetching * Fix test * Add nprogress plugin to list
- Loading branch information
1 parent
711d16d
commit acbc22e
Showing
70 changed files
with
1,411 additions
and
365 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import React from 'react' | ||
import React from "react" | ||
|
||
const IndexRoute = () => ( | ||
const IndexRoute = () => | ||
<div> | ||
<p> | ||
Welcome to the GatsbyJS RSS Demo. | ||
<a href="/rss.xml">Click here</a> | ||
to see the generated RSS Feed. | ||
</p> | ||
</div> | ||
) | ||
|
||
|
||
export default IndexRoute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import React from 'react' | ||
import React from "react" | ||
|
||
const IndexRoute = () => ( | ||
const IndexRoute = () => | ||
<div> | ||
<p> | ||
Welcome to the GatsbyJS Sitemap Demo. | ||
Visit <a href="/sitemap.xml">to see the generated sitemap.</a> | ||
</p> | ||
</div> | ||
) | ||
|
||
|
||
export default IndexRoute |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"env": { | ||
"browser": true | ||
}, | ||
"globals": { | ||
"graphql": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
public | ||
.cache | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# using-page-loading-indicator | ||
|
||
https://using-page-loading-indicator.gatsbyjs.org | ||
|
||
The loading indicator only will show up in the production version of the site. | ||
|
||
So first run `gatsby build` then `gatsby serve`. | ||
|
||
Then you'll need to open up the chrome (or equivalent in other browsers) | ||
devtools and go to the Network tab. There where it says "No throttling" along the | ||
top, click that and use the "Slow 3G" preset (or an equivalent slow speed). | ||
|
||
Then open the built site (generally at localhost:9000) and (important) wait until | ||
the initial four JavaScript files are downloaded then click on the "Page 2" link | ||
and after a second, you'll see the nprogress bar along the top come in. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
plugins: [`gatsby-plugin-nprogress`], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "using-page-loading-indicator", | ||
"private": true, | ||
"description": "Gatsby example site using using-page-loading-indicator", | ||
"author": "Kyle Mathews<[email protected]>", | ||
"dependencies": { | ||
"gatsby": "canary", | ||
"gatsby-link": "canary", | ||
"gatsby-plugin-nprogress": "^0.2.0" | ||
}, | ||
"license": "MIT", | ||
"main": "n/a", | ||
"scripts": { | ||
"develop": "gatsby develop", | ||
"build": "gatsby build" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from "react" | ||
import Link from "gatsby-link" | ||
|
||
class IndexComponent extends React.Component { | ||
render() { | ||
return ( | ||
<div> | ||
<h1>Hello world</h1> | ||
<Link to="/page-2/">Page 2</Link> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default IndexComponent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import React from "react" | ||
|
||
export default () => <div>Page 2</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.