WordPress.org

Forums

W3 Total Cache
How to compress resources with gzip without minifying? (8 posts)

  1. houmie
    Member
    Posted 2 years ago #

    Hello,

    I have noticed today the minifier (doesn't matter, if Closure, YUI or default jsmin) break my template js file:

    wp-content/themes/optimize/includes/js/scripts.js?ver=3.5.1

    I would like to ignore those template files, but Google Page Speed deducts 5 points and with the following warning

    Compressing the following resources with gzip could reduce their transfer size by 96.1KiB (78% reduction).

    78% is quite a lot. The funny part is I have gzip compression in my nginx enabled:

    ## Compression
    gzip on;
    gzip_buffers 16 8k;
    gzip_comp_level 9;
    gzip_http_version 1.1;
    gzip_min_length 0;
    gzip_vary on;

    What could I be missing please?

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. Frederick Townes
    Member
    Plugin Author

    Posted 2 years ago #

    Just matching the right mime-types, W3TC should generate a config consistent with your browser cache settings that take care of this for you. Let me know if you've found a bug.

  3. houmie
    Member
    Posted 2 years ago #

    gzip on;
            gzip_disable "msie6";
    
            gzip_vary on;
            gzip_proxied any;
            gzip_comp_level 9;
            gzip_buffers 16 8k;
            gzip_http_version 1.1;
            gzip_min_length 0;
            gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    This is the full settings with gzip types. The way I see it it is a bug. If you need any more information let me know please.

  4. Frederick Townes
    Member
    Plugin Author

    Posted 2 years ago #

    Have you looked at the nginx file that W3TC generates?

  5. houmie
    Member
    Posted 2 years ago #

    Sure here it is:

    # BEGIN W3TC CDN
    location ~ \.(ttf|otf|eot|woff)$ {
       add_header Access-Control-Allow-Origin "*";
    }
    # END W3TC CDN
    # BEGIN W3TC Browser Cache
    gzip on;
    gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
    location ~ \.(css|htc|js|js2|js3|js4)$ {
        expires 31536000s;
        add_header Pragma "public";
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        add_header X-Powered-By "W3 Total Cache/0.9.2.7";
    }
    location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ {
        expires 3600s;
        add_header Pragma "public";
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        add_header X-Powered-By "W3 Total Cache/0.9.2.7";
        try_files $uri $uri/ $uri.html /index.php?$args;
    }
    location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
        expires 31536000s;
        add_header Pragma "public";
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        add_header X-Powered-By "W3 Total Cache/0.9.2.7";
    }
    # END W3TC Browser Cache
  6. houmie
    Member
    Posted 2 years ago #

    Hi Frederick,

    Just a recap the minifier was breaking the theme js files no matter if I used closure, YUI or default jsmin.

    Hence I decided to ignore these theme js, but despite the gzip compression being enabled, I get a low score from google, saying I should enable compression. It seems W3C only applies compression if minified.

    Compressing the following resources with gzip could reduce their transfer size by 105.2KiB (77% reduction).
    
        Compressing https://cdn.chasebot.com/wp-content/themes/optimize/includes/js/prettyPhoto.js?ver=3.5.1 could save 23.2KiB (74% reduction).

    I see you have mentioned a fix in 0.9.2.8

    - Fixed an issue with auto minify

    Is any of these two problems fixed?

    many thanks

  7. junaid@pkteam.com
    Member
    Posted 1 year ago #

    Any idea on whats the best cache plugin for WordPress?

  8. WPyogi
    Forum Moderator
    Posted 1 year ago #

    @junaid@pkteam.com - why are you posting this on a 7 month-old thread on a different topic IN a sub-forum for a cache plugin? Please start your own NEW thread.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • W3 Total Cache
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.