FR v4: Remove tons of redundant CSS variables #13467
dmitrystas
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
At the moment (v3.4.3) all core plugins that use variables generate a lot of redundant styles. For example, Scale plugin generate
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
for each of all scale-* classes. Translate plugin (as well as all other transform plugins) does the same. All filter plugins (dropShadow, etc) generate
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
Before/After generate
content: var(--tw-content);
, etc.My suggestion is to generate transform (filter, etc) property (with init variable values) only for main
.transform
class, and then Scale plugin will only set --tw-scale-x / --tw-scale-y variables. In other words<div class="transform scale-y-75 md:scale-y-90">test</div>
will generate
instead
The same approach applies to all other plugins plugins that use variables. For example, for Before/After we could totally remove variable and set content only for content-[''] class (or just content for default '' value), and then before:somePlugin, before:anotherOnePlugin will only set their (plugins) properties:
<div class="content-[''] before:absolute before:bg-pink-500>test</div>
will generate
instead
Beta Was this translation helpful? Give feedback.
All reactions