Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

jss-cache

cssinjs692MIT3.0.0

JSS plugin that caches the rules and delivers insane performance.

cssinjs, css-in-js, css in js, jss, plugin, cache, insane

readme

JSS plugin that caches the rules.

This plugin will cache virtual rules by checking if a passt style object has been already passed.

It should be used as a first plugin, to bail out before any unnecessary work is done!!!

Make sure you read how to use plugins in general.

Gitter

Caveats

  1. Don't use it if you mutate your styles.

  2. Don't use it if you generate an huge amount of different rules. For e.g. if you generate for every request or for every user different styles. The cache memory footprint will grow proportionally to the amount of unique styles.

  3. If your styles objects are not static, they won't be cached. It adds a flag to the object in order to identify it and reuses the virtual rule for it then.

Issues

File a bug against cssinjs/jss prefixed with [jss-cache].

Run tests

npm i
npm run test

License

MIT

changelog

3.0.0 / 2017-09-30

  • Support JSS 9

2.0.0 / 2017-06-20

  • Support JSS 8

1.0.0 / 2017-04-10

  • Support JSS 7.0

0.2.2 / 2017-03-23

  • Don't copy marker when cloning styles to avoid to overcome the cache.

0.2.1 / 2017-03-01

  • Fixed improper webpack library name

0.2.0 / 2016-12-26

  • Export marker namespace.
  • Add tests.
  • Better docs.

0.1.0 / 2016-12-25

  • First release.