From 95e474bb2f5015d42b52e98c4c11f901894d6894 Mon Sep 17 00:00:00 2001 From: Yeison Daza Date: Sat, 23 Jun 2018 11:59:30 -0500 Subject: [PATCH 01/54] preload and not bloking Preload docsearch script and no blocking docsearch css --- www/src/html.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/www/src/html.js b/www/src/html.js index 6d0b2ad921246..3be171156b7f3 100644 --- a/www/src/html.js +++ b/www/src/html.js @@ -6,6 +6,11 @@ export default class HTML extends React.Component { return ( + {this.props.postBodyComponents} - + ) From d6f1dbfb95afc19f4bf258029ae12957311be79f Mon Sep 17 00:00:00 2001 From: Jason Lengstorf Date: Sat, 23 Jun 2018 17:38:25 -0700 Subject: [PATCH 02/54] fix: use ES5 syntax --- www/src/html.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/src/html.js b/www/src/html.js index 3be171156b7f3..c0d7dfd521a00 100644 --- a/www/src/html.js +++ b/www/src/html.js @@ -74,8 +74,8 @@ export default class HTML extends React.Component { {this.props.postBodyComponents} ) From f41eb2a58d8a8d5e84663bb6a9080aa6b3d530df Mon Sep 17 00:00:00 2001 From: Jason Lengstorf Date: Sat, 23 Jun 2018 18:19:47 -0700 Subject: [PATCH 04/54] fix: move async CSS load to gatsby-browser.js --- www/gatsby-browser.js | 10 ++++++++++ www/src/html.js | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 www/gatsby-browser.js diff --git a/www/gatsby-browser.js b/www/gatsby-browser.js new file mode 100644 index 0000000000000..7a0b2b00d5460 --- /dev/null +++ b/www/gatsby-browser.js @@ -0,0 +1,10 @@ +exports.onClientEntry = () => { + ;(function() { + const path = `https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css` + const link = document.createElement(`link`) + link.setAttribute(`rel`, `stylesheet`) + link.setAttribute(`type`, `text/css`) + link.setAttribute(`href`, path) + document.head.appendChild(link) + })() +} diff --git a/www/src/html.js b/www/src/html.js index 7ce6debd23c1c..fe8a28f6f6a4c 100644 --- a/www/src/html.js +++ b/www/src/html.js @@ -64,7 +64,10 @@ export default class HTML extends React.Component { color={colors.gatsby} /> -