WordPress.org

Forums

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

  1. Nikolay Yordanov
    Member
    Posted 1 year 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.

    https://wordpress.org/plugins/w3-total-cache/

  2. emielm
    Member
    Posted 1 year 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:
    http://wordpress.org/support/topic/minifying-woocommerce-smallscreencss-breaks-styles?replies=1

  3. Nikolay Yordanov
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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

Tags

No tags yet.