10.0.2-0 • Published 5 years ago

oliviertassinari-jss-plugin-cache v10.0.2-0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

JSS plugin that caches the rules.

This plugin will cache virtual rules by checking if a past 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

Polyfills

  1. This plugin is using a WeakMap. If you support browsers which do not support WeakMap, you will have to include a polyfill.

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

yarn
yarn test

License

MIT