cssinjs / cssinjs/jss

Intelligently deduplicating rules for function values

Open
#501 1 comment 7 reactions 0 assignees View on GitHub
complexity:high enhancement idea
Dominant language
JavaScript
Stars
7.1k
Forks
386
PR merge metrics
No merged PRs in 30d

Description

In case where a property `{width: () => 10}` is used for many elements, we currently generate many rules, despite the fact that the value is always the same. We can optimize that.

```js
// Lets say we have rule "a" and rule "b"
// Their initial value is the same.
a.width = 10
b.width = 10

// We can generate one rule and use both classes:
.a, .b {
width: 10
}

// Now "b" changes:
b.width = 20

// We remove the class "b" from the initial rule:
.a {
width: 10
}
// We create a new rule with the new value for b:
.b {
width: 20
}

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.