mirror of
https://github.com/rowtype-yoga/psfp.git
synced 2024-09-11 16:25:36 +03:00
No idea why but it's much better now
This commit is contained in:
parent
148366ac5d
commit
c2baa78104
4
blog/.vscode/settings.json
vendored
Normal file
4
blog/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"workbench.preferredDarkColorTheme": "Base2Tone_HeathDark",
|
||||
"workbench.colorTheme": "Base2Tone_FieldDark"
|
||||
}
|
21
blog/gatsby-browser.js
Normal file
21
blog/gatsby-browser.js
Normal file
@ -0,0 +1,21 @@
|
||||
import React from "react";
|
||||
import {JssProvider, SheetsRegistry} from 'react-jss'
|
||||
|
||||
export const onInitialClientRender = () => {
|
||||
if (process.env.BUILD_STAGE === `develop`) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove the server-side injected CSS.
|
||||
const jssStyles = document.querySelector(`#jss-server-side`);
|
||||
if (jssStyles) {
|
||||
jssStyles.parentNode.removeChild(jssStyles);
|
||||
}
|
||||
};
|
||||
|
||||
export const wrapRootElement = ({ element }) => {
|
||||
|
||||
return element;
|
||||
// return <StylesProvider {...stylesProvider}>{element}</StylesProvider>;
|
||||
// return <JssProvider registry={sheets}>{element}</JssProvider>
|
||||
};
|
0
blog/gatsby-node.js
Normal file
0
blog/gatsby-node.js
Normal file
37
blog/gatsby-ssr.js
Normal file
37
blog/gatsby-ssr.js
Normal file
@ -0,0 +1,37 @@
|
||||
import React from 'react'
|
||||
import {JssProvider, SheetsRegistry} from 'react-jss'
|
||||
|
||||
const globalLeak = new Map();
|
||||
|
||||
export const wrapRootElement = ({ element, pathname }) => {
|
||||
const sheets = new SheetsRegistry()
|
||||
globalLeak.set(pathname, sheets);
|
||||
|
||||
return <JssProvider registry={sheets}>{element}</JssProvider>
|
||||
}
|
||||
|
||||
export const onRenderBody = (
|
||||
{ setHeadComponents, pathname },
|
||||
) => {
|
||||
const sheets = globalLeak.get(pathname);
|
||||
|
||||
if (!sheets) {
|
||||
return;
|
||||
}
|
||||
|
||||
const css = sheets.toString();
|
||||
|
||||
// css = disableAutoprefixing ? css : autoprefixer(css, pathname);
|
||||
// css = disableMinification ? css : cleanCSS.minify(css).styles;
|
||||
|
||||
setHeadComponents([
|
||||
<style
|
||||
id="jss-server-side"
|
||||
key="jss-server-side"
|
||||
dangerouslySetInnerHTML={{ __html: css }}
|
||||
/>,
|
||||
]);
|
||||
|
||||
globalLeak.delete(pathname);
|
||||
};
|
||||
|
8
blog/package-lock.json
generated
8
blog/package-lock.json
generated
@ -8875,6 +8875,14 @@
|
||||
"@babel/runtime": "^7.2.0"
|
||||
}
|
||||
},
|
||||
"gatsby-plugin-better-jss": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/gatsby-plugin-better-jss/-/gatsby-plugin-better-jss-1.0.3.tgz",
|
||||
"integrity": "sha512-1NG68s+8vpknG4CpaH7a3ac0NItWNsk8HWma9wr+NnuCYM8buBnE1MbYzbycKYkjNZZ6DAeISJpKqtbheJPyYg==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"gatsby-plugin-manifest": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/gatsby-plugin-manifest/-/gatsby-plugin-manifest-2.3.3.tgz",
|
||||
|
@ -11,6 +11,7 @@
|
||||
"gatsby": "^2.19.45",
|
||||
"gatsby-image": "^2.2.8",
|
||||
"gatsby-plugin-alias-imports": "^1.0.5",
|
||||
"gatsby-plugin-better-jss": "^1.0.3",
|
||||
"gatsby-plugin-manifest": "^2.3.2",
|
||||
"gatsby-plugin-mdx": "^1.0.0",
|
||||
"gatsby-plugin-offline": "^2.2.4",
|
||||
|
Loading…
Reference in New Issue
Block a user