-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: BREAKING CHANGE: Themes set *all* variables in a VarGroup. always. #631
Conversation
compressed-size: runtime library Size change: 0.00 kB View unchanged
|
compressed-size: e2e bundles Size change: 0.00 kB View unchanged
|
Having options means that code could be author using one option and then work totally differently if used in a project that sets a different option. Internally we're only going to use one of these so probably best to just add that one. The extra complexity here doesn't seem worth it to me |
I agree that the complexity isn't worth it. I didn't want to make a decision at the time as I don't agree with how Both |
13c5b47
to
d02f451
Compare
workflow: benchmarks/sizeComparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.
|
d02f451
to
cce5a8b
Compare
Partially addresses #601
Terminology:
VarGroup
- A group of variables created bystylex.defineVars
. These variables have default values.Theme
- A className generated that sets some or all of the variables in aVarGroup
to alternate values.The Change
Changes the way
stylex.createTheme
such that when creating aTheme
for a givenVarGroup
, any variables from theVarGroup
that are NOT overridden will be set to their default value.In practice, this means that the variables within a
VarGroup
will have at most one theme applied.This also means that generating a theme to reset all variables within a
VarGroup
is as easy as:stylex.createTheme
can be used in any file, so this can be defined in the component file where a theme needs to be reset. Further, defining the same theme in multiple files will not result in duplicate CSS, and so it is safe to repeat this declaration wherever it is needed.Next Steps
A follow-up PR will detect CSS variables that point to other variables and add a minimal amount of CSS to handle those cases specifically.