facebook / facebook/stylex

[babel-plugin] Optimize dynamic styles output

Open
#1,167 1 comment 1 reaction 1 assignee Claimed by @mellyeliu View on GitHub
Dominant language
JavaScript
Stars
10.3k
Forks
481
Avg merge
3d 8h
Merged PRs (30d)
13

Description

Follow up to https://github.com/facebook/stylex/pull/1153

There are times in which we don't need to emit a ternary wrapping dynamic styles when we can confirm the expression is not `null` or `undefined`. We have coverage for `binary` and `unary` expressions, but there are a few more cases we can optimize for:
- template literals
- conditional exprs (recursively check both sides)
- logical expressions like
- nullish coalescing `??` (if left side is safe)
- logical or `||` (if either side is safe)
- logical `&&` (both sides are safe ie. a string/binary/unary/template literal of course).

May be missing some cases

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.