npm.io
2.0.1 • Published 8 years ago

inject-static-sheet

Licence
ISC
Version
2.0.1
Deps
1
Size
3 kB
Vulns
0
Weekly
0
Stars
1

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}>

Keywords