• Resolved rom174

    (@rom174)


    Hello,

    Thank you for this very very useful plugin. Works perfectly !

    I came here refering to the faq about this point :

    Can the generated JS/ CSS be pre-gzipped?

    Yes, but this is off by default. You can enable this by passing ´true´ to ´autoptimize_filter_cache_create_static_gzip´. You’ll obviously still have to configure your webserver to use these files instead of the non-gzipped ones to avoid the overhead of on-the-fly compression.

    I have monitored my waterfall and realised that the main css file is served 10% of the true size.
    So, I guess this is gzipped file ?
    BUT, looking at autoptimizeCache.php, the filter ´autoptimize_filter_cache_create_static_gzip´ is set to false.

    My questions :

    How can the webserver serves generated gzipped files if this set to false ( .htaccess ?) ?

    Should I take care of it if my received CSS is already 10% of the one on the server ?
    Why is this filter made for and when ?

    After modifying the filter to true, how can I configure my webserver to be sure to use these files (that I can see in /wp-content/cache/autoptimize/js or /css) ? and be sure the compressed version is used and uncompressed by the browser ?

    Thank you very much

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    there’s a difference between pre-gzipping (which is off by default) and normal gzipping (which the webserver does on-the-fly if all is well). what you’re seeing is the latter

    if the filter is set to true (with a code snippet) you will see the gzipped files being created immediately, i.e. before they are requested (but this indeed requires webserver configuration as explained e.g. here).

    hope this clarifies,
    frank

    Thread Starter rom174

    (@rom174)

    So quick, thank you for the reply @optimizingmatters !

    Ok I think I understand. This is a way to not wait the time of a request to compress the file but doing it as soon as it is modified. Isn’t it ?

    2 questions :

    Sorry for this question, what would be the code snippet to put in functions.php ? (in order not override it during the next update)

    In the answer on stack overflow, post author said :

    You can put that either in a <Directory foo/> section or in a .htaccess file if you do not have access to apache configuration or if you want to slowdown your webserver.

    I guess there is kind of irony here but I am not sure to get everything of this sentence so, for you, what/where is the best place to put it if not in .htaccess file ?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    1. easiest & safest is using the code snippets plugin

    2. in your apache configuration files, but you might not have access to those so .htaccess is the most obvious place 🙂

    Thread Starter rom174

    (@rom174)

    Okay, thanks

    A very last question, I have setup back the filter on false and cleared the cache. Of course I can’t see the .css.gz/.js.gz files anymore. But the main css file served is still showing Accept-Encoding : gzip, deflate, br and still sized at 10% of the original.
    So, does it mean the server is doing the gzip compression every time/visit it is served for every assets until the filter is set to ‘on’?
    If yes, as I can’t see any .gz files in the waterfall, would you know where to access these .gz assets browser side (as we can see it on the server when filter is ‘true’ but just before the browser uncompress it) ? In a temp directory or something like this ?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    So, does it mean the server is doing the gzip compression every time/visit it is served for every assets until the filter is set to ‘on’?

    yes

    would you know where to access these .gz assets browser side (as we can see it on the server when filter is ‘true’ but just before the browser uncompress it)

    you can’t, it’s the .css or .js file which is being sent over gzipped (or deflated) without the filename changing. one of the indications is the difference between “file size” and “transfer size” in your browser’s network tab, the other one the content-encoding HTTP response header.

    Thread Starter rom174

    (@rom174)

    So many thanks for taking time to anwser my questions and doing it that fast.
    Thanks,
    Rom

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Enabled pre-gzip for generated CSS/JS’ is closed to new replies.