gatsby-plugin-jss
Version:
Gatsby plugin that adds SSR support for JSS
20 lines (18 loc) • 648 B
JavaScript
;
var React = require("react");
var ThemeProvider = require("react-jss").ThemeProvider;
// remove the JSS style tag generated on the server to avoid conflicts with the one added on the client
exports.onInitialClientRender = function () {
var ssStyles = window.document.getElementById("server-side-jss");
if (ssStyles) {
ssStyles.parentNode.removeChild(ssStyles);
}
};
// eslint-disable-next-line react/prop-types
exports.wrapRootElement = function (_ref, options) {
var element = _ref.element;
var theme = options.theme || {};
return /*#__PURE__*/React.createElement(ThemeProvider, {
theme: theme
}, element);
};