Skip to content
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

Remove emotion-utils and use packages from emotion-js/next #628

Merged
merged 8 commits into from
Apr 16, 2018

Conversation

emmatown
Copy link
Member

@emmatown emmatown commented Apr 14, 2018

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/gzip
react-emotion is now 8.27kb min/gzip

Why:

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:

  • Documentation N/A
  • Tests
  • Code complete

@codecov
Copy link

codecov bot commented Apr 14, 2018

Codecov Report

Merging #628 into master will decrease coverage by 0.04%.
The diff coverage is 100%.

Impacted Files Coverage Δ
packages/create-emotion/src/utils.js 100% <ø> (ø) ⬆️
packages/babel-plugin-emotion/src/index.js 96.83% <ø> (ø) ⬆️
packages/create-emotion-styled/src/index.js 100% <100%> (ø) ⬆️
packages/create-emotion/src/index.js 100% <100%> (ø) ⬆️

@tkh44 tkh44 merged commit 82fd71a into master Apr 16, 2018
@tkh44 tkh44 deleted the remove-emotion-utils branch April 16, 2018 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants