Ready to get started?Download WordPress


W3 Total Cache
Media queries and CSS minify (5 posts)

  1. Nikolay Yordanov
    Posted 5 months ago #

    Has this been fixed: https://wordpress.org/support/topic/plugin-w3-total-cache-please-solve-this-css-minify-problem

    WooCommerce 2.1 uses it and updating the plugin on sites with W3TC causes the styles to break, unless you manually exclude plugins/woocommerce/assets/css/woocommerce-smallscreen.css.


  2. emielm
    Posted 5 months ago #

    I have the same problem and started the same topic here at woocommerce support, since we don't know if it's w3tc or woocommerce causing this:

  3. Nikolay Yordanov
    Posted 5 months ago #

    WooCommerce uses the optional $media parameter of wp_enqueue_script: https://codex.wordpress.org/Function_Reference/wp_enqueue_style.

    W3TC completely ignores this, so I'm guessing that it's a W3TC issue and it's not related to WooCommerce. The solution is to only combine files which have the same media attribute.

    See also:

    1. https://github.com/woothemes/woocommerce/blob/9a115dc1f4b984e8249c8bbd7a612669055bc249/includes/class-wc-frontend-scripts.php#L38
    2. https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries
  4. emielm
    Posted 5 months ago #

    Thanks a lot for your reply Nikolay!
    So that would mean that minification of all css is not possible with this woocommerce-smallscreen.css file inlcuded and only combining css files will be possible untill w3tc software will take optional $media paramters in account?

  5. Nikolay Yordanov
    Posted 5 months ago #

    Yes. Right now the only solution is to exclude this file so that it's not minified.

    Ideally, it would be great if it can be minified without stripping the media attribute from the <link> element.


You must log in to post.

About this Plugin

About this Topic


No tags yet.