Compression of Javascript and CSS on server

I know we have minifciation inside Blocs with project exports, however this is different from server compression through Gzip or Brotli. I know it is not a good idea to compress all, since images effectively have their own compression and that can make sites slower loading, so I want to limit this to code.

Inside cPanel I am seeing the default as being set to compress “text/html text/plain text/xml” and I am wondering why it isn’t set to include CSS and Javascript with something like:

text/html text/plain text/xml text/javascript text/css

I’ve just tried this on a couple of sites and it seems fine, but for those who are used to doing more code work I wondered if this compression might break anything on a site?

Thanks @Flashman, I see this cPanel come up in various post. The only cPanel I’m aware of is the one from my Hosting Server, is there something I’m missing?

Yes that is the same cPanel I am talking about but thinking in relation to sites built with Blocs. I have actually heard that minification and compression can break sites built in Wordpress for example.

I would guess that 90% of Blocs users are on servers running cPanel, though some may be using Plex or something more obscure. If you look inside cPanel there is a section to optimise the website where you can enable Gzip compression for even Brotli if enabled in the PHP settings. This makes the contents physically smaller for faster page loading. In some cases it’s a major saving in page size.

I don’t see any risk with compressing html but I did wonder if compressing CSS or Javascript might break custom brics or a CMS for example. The easy way to enable it is on the control panel, however it could also be done using htaccess or even the config file if you have access.

It’s not a minify. It’s a zip on server side, and an unzip on browser side. Nothing to worry about.

Thanks for clarifying. I was fairly sure that was the case, but wanted some sort of confirmation, especially after hearing that it has caused problems for some Wordpress users. Compressing Javascript and CSS could save a lot of size on some sites. I had read earlier about the differences between minification at time of export and compression at a server level.