Best way to compress HTML, CSS & JS with mod_deflate and mod_gzip disabled

前端 未结 5 1868
轻奢々
轻奢々 2021-02-20 17:48

I have a few sites on a shared host that is running Apache 2. I would like to compress the HTML, CSS and Javascript that is delivered to the browser. The host has disabled mod_d

5条回答
  •  野的像风
    2021-02-20 18:09

    Instead of gzipping on the fly when users request the CSS and JavaScript files, you could gzip them ahead of time. As long as Apache serves them with the right headers, you’re golden.

    For example, on Mac OS X, gzipping a file on the command line is as easy as:

    gzip -c styles.css > styles-gzip.css
    

    Might not be the sort of workflow that works for you though.

提交回复
热议问题