inject-static-sheet

2.0.1 • Public • Published

Inject Static Sheet

A wrapper for react-jss injectSheet, resulting in deterministic className prefixing.

Usage

Call injectSheet as usual, but pass an additional prefix argument. This will be used to fix the className prefix to a consistent string, rather than a generated hash of IDs which differ across environment (which is the default behaviour):

const styleSheet = {
	someClass: {...}
};
export default injectSheet(styleSheet, 'MyComponentPrefix')(MyComponent);

Output: <marquee class="MyComponentPrefix--someClass">Deprecated lol</marquee>

generateClassName is also available for direct use, where only the function its self needs to be overridden. This can be useful when passing as a prop to a JssProvider:

<JssProvider generateClassName={generateClassName}>

Package Sidebar

Install

npm i inject-static-sheet

Weekly Downloads

6

Version

2.0.1

License

ISC

Unpacked Size

3.33 kB

Total Files

4

Last publish

Collaborators

  • dndhm