Remove emotion-utils and use packages from emotion-js/next #628
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What:
Remove emotion-utils and use packages from emotion-js/next. This decreases the size of emotion by around 1.2kb.
emotion
is now 5.52kb min/gzipreact-emotion
is now 8.27kb min/gzipWhy:
I wanted to experiment with making stylis smaller by compiling out parts that we don't use but that meant not supporting certain options that stylis supports which would require a major release for emotion-utils.
How:
I wrote a little script that reads stylis's src, changes the defaults of the options, removes the cases in stylis'
set
function that set the options that we don't change at runtime and uses the Google Closure Compiler REST API to minify it (running the js version of GCC locally didn't work with stylis when I tried it last time). Since removing the cases in stylis'set
function that set the options makes the options static, GCC can inline them and remove the unused code.Checklist: