cssinjs / cssinjs/jss

Allow empty styles at runtime

Open
#617 2 comments 0 reactions 0 assignees View on GitHub
complexity:moderate enhancement
Dominant language
JavaScript
Stars
7.1k
Forks
386
PR merge metrics
No merged PRs in 30d

Description

For dynamic styles/rules we need to allow them render empty in order to be linked and so props can be defined later. Right now the logic allows empty rules only if link: true option is used, which works fine.

Though, a more straight forward way would be to always allow empty rules. We need to skip empty rules only when we do SSR or build-time extraction in order to remove unused CSS.

Empty rules could be generated when a function which returns styles, but, based on some condition, returns an empty value and user is unaware. In general it is a quite rare case and gave us headaches with dynamic cases where rules are generated by Observables and evtl. by functions in the future.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.