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

  1. Nikolay Yordanov
    Posted 2 years 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 2 years 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 2 years 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 2 years 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 2 years 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.

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


No tags yet.