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

compress assets with brotli as well as gzip #71

Open
mappu opened this issue Jul 11, 2019 · 1 comment

Comments

@mappu
Copy link

commented Jul 11, 2019

Hi,

Brotli is a new compression method that produces smaller files than gzip. It's well supported by browsers.

It should be possible to compress the webroot directory with both gzip and brotli; store both versions in the generated assets.go file; and serve the best version of the file if br is in the Accept-Encoding header.

The main C brotli encoder/decoder has a CGO wrapper here: https://github.com/google/brotli/tree/master/go

There is also a pure-Go version of the brotli encoder/decoder here https://github.com/andybalholm/brotli converted with c2go (read more)

Thanks

@dmitshur

This comment has been minimized.

Copy link
Member

commented Aug 12, 2019

Thanks for posting this this feature request.

It should be possible to compress the webroot directory with both gzip and brotli; store both versions in the generated assets.go file; and serve the best version of the file if br is in the Accept-Encoding header.

Doing that has a trade-off of making the generated assets file roughly 2x larger.

As a result, it might be preferable to make it an option (generate gzip only, generate Brotli only, generate both, and maybe some other combinations).

This decision is worth thinking about more. I want to make sure there aren't some other unexpected implications when going from 1 compression algorithm to more than 1.

There is also a pure-Go version of the brotli encoder/decoder here https://github.com/andybalholm/brotli converted with c2go (read more)

Oh, I didn't know a pure Go Brotli encoder exists by now, thank you for sharing that! (I was only aware of a pure Go decoder at github.com/dsnet/compress/brotli.) /cc @dsnet

At this time, I don't expect to have the time to work on this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.