Note: below is a partial translation of the article “Compress JavaScript and CSS without touching your application code” , which describes static compression of CSS and JS files on the server and then correctly outputting them to the client.The following are my comments with a more comprehensive solution.I apologize if the topic is too familiar or uninteresting for someone: it was not possible to find a normal article on this particular topic in RuNet.
In order to ensure the correct archiving of your web content, it seems that the most common approach will be to perform the following items in order:
Check if the client is able to receive files in gzip-encoded format.
Provide the appropriate server-side output via gzip-functions, or rely on Apache to do all this directly.
Play with .htaccess to provide the correct content type .