Enable compression on dev server responses #419
Merged
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.
Fixes #416
Enables compression for files sent in dev server.
I went ahead and added
br
anddeflate
quickly since they were only a couple extra if statements. Let me know if you would like those removed.Without compression:
![image](https://user-images.githubusercontent.com/855184/83667041-6dd9fe80-a593-11ea-9c5f-b579dcf5da46.png)
With gzip compression:
![image](https://user-images.githubusercontent.com/855184/83667086-82b69200-a593-11ea-9959-7b7c880f3135.png)
@FredKSchott We shouldn't be applying compression to binary files, I'm not currently accounting for that. Should I add a lib like
compressible
to determine it? (Update: Added as a separate commit which we can remove if you want)Future enhancements, we could check the file size and apply a threshold before compressing since sometimes smaller files can actually get larger and just cause an additional load to the server