getzola / zola

A fast static site generator in a single binary with everything built-in. https://www.getzola.org
https://www.getzola.org
MIT License
13.61k stars 950 forks source link

add Brotli compression #1520

Open vitaly-zdanevich opened 3 years ago

doamatto commented 3 years ago

I assume this is meant for the zola serve command? Otherwise, you can configure brotli compression for most web servers already, making this a non-issue.

tl;dr: can you elabourate, please and thank you?

vitaly-zdanevich commented 3 years ago

For zola serve and zola build. As I understand for output you must create filename.br.

See https://gitlab.com/gitlab-org/gitlab-pages/-/issues/125

doamatto commented 3 years ago

Don't know why I didn't think it was possible to only compress the files for some reason. Think the best package for this may be dropbox/rust-brotli, but most of the packages I've seen aren't the most up-to-date, unfortunately. We could do a drop-in of the C package, similar to libsass

Keats commented 3 years ago

I would have thought the services where you're hosting the pages would do the compression themselves but I guess it can't hurt to do it ourselves.

We could do a drop-in of the C package, similar to libsass

Let's avoid that, libsass causes so many issues on Windows I don't want to add more.

vitaly-zdanevich commented 3 years ago

According to Gitlab documentation now I use this on Alpine image:

- apk add brotli
- find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec brotli -f -k {} \;
doamatto commented 3 years ago

According to Gitlab documentation now I use this on Alpine image:

- apk add brotli
- find public -type f -regex '.*\.\(htm\|html\|txt\|text\|js\|css\)$' -exec brotli -f -k {} \;

I think it would be ideal to bake it into Zola instead of either having it as a dependency or a bundled executable. Zola's goal is aimed to be one executable at the end of day and not have the dependency hell. (correct me if im wrong ofc)