How can I gzip my JavaScript and CSS files?

后端 未结 6 1025
独厮守ぢ
独厮守ぢ 2021-02-05 07:52

I have a problem, I have to gzip a prototype Lib, but i totaly have no idea how to do this, where to start and how does it works. :)

I find some tutorials but that wasn\

6条回答
  •  借酒劲吻你
    2021-02-05 08:04

    Hi If you are using Nginx server the above will not help. Please edit the with command vi /etc/nginx/nginx.conf and add the below lines.

    gzip on;
    gzip_http_version 1.1;
    gzip_comp_level 2;
    gzip_types    text/plain text/html text/css
              application/x-javascript text/xml
              application/xml application/xml+rss
              text/javascript;
    

    Restart the nginx with command /etc/init.d/nginx reload . It will compress the JS and CSS files.

提交回复
热议问题