From 38a988dd5a8c4f81ecbf678cbf4b8c633f4c684a Mon Sep 17 00:00:00 2001 From: Marija Najdova Date: Fri, 25 Sep 2020 12:03:27 +0200 Subject: [PATCH 1/2] fixed emotion ssr --- docs/package.json | 2 +- docs/pages/_app.js | 2 +- docs/pages/_document.js | 5 ++++- yarn.lock | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/package.json b/docs/package.json index f047b53ee9be6d..fc01fe1f5a4a1d 100644 --- a/docs/package.json +++ b/docs/package.json @@ -66,12 +66,12 @@ "clipboard-copy": "^3.0.0", "clsx": "^1.0.4", "core-js": "^2.6.11", + "create-emotion-server": "^10.0.27", "cross-env": "^7.0.0", "css-mediaquery": "^0.1.2", "date-fns": "^2.15.0", "docsearch.js": "^2.6.3", "doctrine": "^3.0.0", - "emotion-server": "^10.0.27", "emotion-theming": "^10.0.27", "express": "^4.17.1", "fg-loadcss": "^2.0.1", diff --git a/docs/pages/_app.js b/docs/pages/_app.js index 5f630b1c1ce66b..8fee303314c00d 100644 --- a/docs/pages/_app.js +++ b/docs/pages/_app.js @@ -281,7 +281,7 @@ function findActivePage(currentPages, pathname) { } // Cache for the ltr version of the styles -const cacheLtr = createCache(); +export const cacheLtr = createCache(); cacheLtr.compat = true; // Cache for the rtl version of the styles diff --git a/docs/pages/_document.js b/docs/pages/_document.js index 0229e37934d88f..79dbac8c563514 100644 --- a/docs/pages/_document.js +++ b/docs/pages/_document.js @@ -1,11 +1,14 @@ import React from 'react'; import { ServerStyleSheets } from '@material-ui/styles'; import { ServerStyleSheet } from 'styled-components'; -import { extractCritical } from 'emotion-server'; +import createEmotionServer from 'create-emotion-server' import Document, { Html, Head, Main, NextScript } from 'next/document'; import { LANGUAGES_SSR } from 'docs/src/modules/constants'; import { pathnameToLanguage } from 'docs/src/modules/utils/helpers'; import { themeColor } from 'docs/src/modules/components/ThemeContext'; +import { cacheLtr } from 'docs/pages/_app'; + +const { extractCritical } = createEmotionServer(cacheLtr) // You can find a benchmark of the available CSS minifiers under // https://github.com/GoalSmashers/css-minification-benchmark diff --git a/yarn.lock b/yarn.lock index de6214c43ed174..06afafd8e30e26 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5540,7 +5540,7 @@ create-ecdh@^4.0.0: bn.js "^4.1.0" elliptic "^6.0.0" -create-emotion-server@10.0.27: +create-emotion-server@10.0.27, create-emotion-server@^10.0.27: version "10.0.27" resolved "https://registry.yarnpkg.com/create-emotion-server/-/create-emotion-server-10.0.27.tgz#24b135d9ef3bca32b6812c0b670feb675edd17e3" integrity sha512-1EbZgdjiho9ue1BSTpAez8SIdfbTXomtz0bg+LPOEvf/5OV7xqCGJaoSCDCB+y7kZ73hwoEhLsoPmqKSGIQMXg== From 258d12bb16e92052091904678db713694009c447 Mon Sep 17 00:00:00 2001 From: Marija Najdova Date: Fri, 25 Sep 2020 12:08:47 +0200 Subject: [PATCH 2/2] prettier --- docs/pages/_document.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pages/_document.js b/docs/pages/_document.js index 79dbac8c563514..9756c9020de1b2 100644 --- a/docs/pages/_document.js +++ b/docs/pages/_document.js @@ -1,14 +1,14 @@ import React from 'react'; import { ServerStyleSheets } from '@material-ui/styles'; import { ServerStyleSheet } from 'styled-components'; -import createEmotionServer from 'create-emotion-server' +import createEmotionServer from 'create-emotion-server'; import Document, { Html, Head, Main, NextScript } from 'next/document'; import { LANGUAGES_SSR } from 'docs/src/modules/constants'; import { pathnameToLanguage } from 'docs/src/modules/utils/helpers'; import { themeColor } from 'docs/src/modules/components/ThemeContext'; import { cacheLtr } from 'docs/pages/_app'; -const { extractCritical } = createEmotionServer(cacheLtr) +const { extractCritical } = createEmotionServer(cacheLtr); // You can find a benchmark of the available CSS minifiers under // https://github.com/GoalSmashers/css-minification-benchmark