How to use the jss.options 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 ErikDakoda / vulcan-material-ui / modules / createJssContext.js View on Github external
// Sanitize the string as will be used in development to prefix the generated
    // class name.
    meta = meta.replace(new RegExp(/[!"#$%&'()*+,./:; <=>?@[\\\]^`{|}~]/g), '-');
  
    return `${meta}-${rule.key}-${ruleCounter}`;
  }
  
  return `${rule.key}-${ruleCounter}`;
};




//const jss = create(preset());
jss.setup(preset());
jss.options.createGenerateClassName = () => generateClassName;


const sheetsManager = new Map();
const sheetsRegistry = new SheetsRegistry();


export default function createJssContext() {
  return {
    jss,
    theme: getCurrentTheme(),
    // 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,
  };
}