How to use the jss.SheetsRegistry function in jss

To help you get started, we’ve selected a few jss examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github drex44 / good-food-guide / www / src / getPageContext.js View on Github external
function createPageContext() {
  return {
    theme,
    // This is needed in order to deduplicate the injection of CSS in the page.
    sheetsManager: new Map(),
    // This is needed in order to inject the critical CSS.
    sheetsRegistry: new SheetsRegistry(),
    // The standard class name generator.
    generateClassName: createGenerateClassName(),
  };
}
github mayneyao / gine-blog / src / getPageContext.js View on Github external
function createPageContext () {
    return {
        theme,
        // This is needed in order to deduplicate the injection of CSS in the page.
        sheetsManager: new Map(),
        // This is needed in order to inject the critical CSS.
        sheetsRegistry: new SheetsRegistry(),
        // The standard class name generator.
        generateClassName: createGenerateClassName(),
    }
}
github MacKentoch / react-redux-nextjs-material-ui-pwa-starter / styles / getContext.js View on Github external
function createContext() {
  return {
    jss,
    theme,
    // This is needed in order to deduplicate the injection of CSS in the page.
    sheetsManager: new Map(),
    // This is needed in order to inject the critical CSS.
    sheetsRegistry: new SheetsRegistry(),
  };
}
// #endregion
github garrynsk / gatsby-seo-starter / src / getPageContext.tsx View on Github external
function createPageContext() {
  return {
    theme,
    // This is needed in order to deduplicate the injection of CSS in the page.
    sheetsManager: new Map(),
    // This is needed in order to inject the critical CSS.
    sheetsRegistry: new SheetsRegistry(),
    // The standard class name generator.
    generateClassName: createGenerateClassName(),
  }
}
github mui-org / material-ui / docs / src / modules / styles / getPageContext.js View on Github external
function createPageContext() {
  return {
    jss,
    theme,
    // This is needed in order to deduplicate the injection of CSS in the page.
    sheetsManager: new Map(),
    // This is needed in order to inject the critical CSS.
    sheetsRegistry: new SheetsRegistry(),
    generateClassName: createGenerateClassName({
      productionPrefix: 'j', // Reduce the bandwidth usage.
    }),
  };
}
github mui-org / material-ui / examples / create-react-app-with-flow / src / styles / createContext.js View on Github external
export default function createContext() {
  return {
    jss,
    theme,
    // This is needed in order to deduplicate the injection of CSS in the page.
    sheetsManager,
    // This is needed in order to inject the critical CSS.
    sheetsRegistry: new SheetsRegistry(),
    generateClassName: createGenerateClassName(),
  };
}
github mui-org / material-ui / examples / nextjs / src / getPageContext.js View on Github external
function createPageContext() {
  return {
    theme,
    // This is needed in order to deduplicate the injection of CSS in the page.
    sheetsManager: new Map(),
    // This is needed in order to inject the critical CSS.
    sheetsRegistry: new SheetsRegistry(),
    // The standard class name generator.
    generateClassName: createGenerateClassName(),
  };
}
github ApiTreeCZ / alda / client / styles / StylesContext.ts View on Github external
const createPageContext = (paletteType: PaletteType) => ({
    jss,
    theme: createMuiTheme({palette: CustomPalette[paletteType]}),
    // theme: getTheme(palette),
    // This is needed in order to deduplicate the injection of CSS in the page.
    sheetsManager: new Map(),
    // This is needed in order to inject the critical CSS.
    sheetsRegistry: new SheetsRegistry(),
    generateClassName: createGenerateClassName({productionPrefix: 'j'}),
});
github mui-org / material-ui / packages / material-ui-benchmark / src / server.js View on Github external
function renderBox(req, res) {
  const sheetsRegistry = new SheetsRegistry();
  const html = ReactDOMServer.renderToString(
    
      
        {Array.from(new Array(1000)).map((_, index) => (
          
        ))}
      
    ,
  );
  const css = sheetsRegistry.toString();
  res.send(renderFullPage(html, css));
}
github mui-org / material-ui / docs / src / pages / customization / css-in-js / JssRegistry.js View on Github external
import React from 'react';
import { JssProvider } from 'react-jss';
import { SheetsRegistry } from 'jss';
import { createMuiTheme, MuiThemeProvider } from '@material-ui/core/styles';
import CssInJs from './CssInJs';

const sheetsRegistry = new SheetsRegistry();
const theme = createMuiTheme({ typography: { useNextVariants: true } });

class JssRegistry extends React.Component {
  state = {
    length: 0,
  };

  componentDidMount() {
    this.update();
  }

  componentDidUpdate() {
    this.update();
  }

  componentWillUnmount() {