• Resolved Vijay Padiyar

    (@vijaypadiyar)


    Hello

    I am seeing an issue with latest version of W3 Total Cache (0.9.3) where some CSS files are not getting minified.

    I am using manual minification. I have added a bunch of CSS files to the list and selected “All templates” for all of them. However, the minified .css file does not contain all the CSS files and many of them are loaded individually.

    The problem is specific to those files which do not have any version string at the end. For such files, the site URL is stripped and only the rest of the URL is stored. That seems to be causing the issue. Because the CSS files which have version strings are stored with the full URL and are correctly minified into a single CSS file.

    If you want to check out the problem live, you can visit my site https://www.vijaypadiyar.in. Look at the page source and search for “.css”. You will see a bunch of them, although there should be only one.

    Please look into this ASAP!

    Thanks

    Vijay Padiyar

    https://www.ads-software.com/plugins/w3-total-cache/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Vijay Padiyar

    (@vijaypadiyar)

    After looking at some of the other threads highlighting the same problem, it appears the minified CSS files are being loaded twice, once as part of the minified single .css file and then again as part of the original .css file.

    Request all of you not to upgrade to version 0.9.3 as Minify functionality is clearly broken.

    Regards

    Vijay Padiyar

    Thread Starter Vijay Padiyar

    (@vijaypadiyar)

    After getting fed up of waiting for someone to suggest a fix, I took it upon myself and finally found the fix.

    The fix is to comment out the following lines in lib\W3\Plugin\Minify.php (these lines were added in version 0.9.3):

    // local CSS files
                    $file = ltrim($file, '/');
                    if (ltrim(w3_get_site_path(),'/') && strpos($file, ltrim(w3_get_site_path(),'/')) === 0)
                        $file = str_replace(ltrim(w3_get_site_path(),'/'), '', $file);

    and:

    // local JS files
                    $file = ltrim($file, '/');
                    if (ltrim(w3_get_site_path(),'/') && strpos($file, ltrim(w3_get_site_path(),'/')) === 0)
                        $file = str_replace(ltrim(w3_get_site_path(),'/'), '', $file);

    Let me know if this works for you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Some CSS files not getting minified’ is closed to new replies.