Support » Plugins » [Plugin: W3 Total Cache] Cannot minify CSS files

  • First a big thank you for the author of this great plugin. I really like it. There is currently one issue with the pluging that I cannot get resolved:
    I cannot get my CSS (and probably also JS files) to get minified. I’ve tried different configurations and setups (I even removed the WP Super Cache plugin) but so far I have never gotten it to work.

    My specs:
    -Wordpress 3.0
    -W3 Total Cache latest (development) version (2010-07-10)
    -My active plugins: ‘Askimet’, ‘All in One SEO Pack’, ‘Contact Form 7’, ‘Customize Meta Widget’, ‘Google Analytics for WordPress’, ‘Google XML Sitemaps’, ‘Login LockDown’, ‘NextGEN Gallery’, ‘Really Simple CAPTCHA’, ‘Silverlight for WordPress’, ‘Smart Youtube’, ‘TinyMCE Advanced’, ‘Twitter Widget Pro’, ‘WordPress.com Popular Posts’, ‘WordPress.com Stats’, ‘WordPress Mobile Edition’, ‘WP-Syntax’ and ‘XML Google Maps’.

    In W3 Total Cache I have only enabled ‘Minify’.

    I’ve configured W3 Total Cache and Minify like this:
    -Rewrite URL structure (enabled)
    -Automatically upload modified files (disabled)
    -HTML minify settings (all enabled)
    -JS minify settings (all enabled)
    -CSS minify settings (all enabled except for “Combine only”)
    -CSS file management: (selected Twenty Ten theme + added relatieve urls for five css files used by Twenty Ten theme and other plugins and added them to ‘all template’ group; all url’s are verified)
    -Minify debug mode is turned on
    -Minify Cache Method: set to disk.

    The speed plugin in Firefox (using FireBug) gives me this feedback:

    Minifying the following CSS resources could reduce their size by 7.2KiB (23% reduction).

    * Minifying http://mysite/wp-content/themes/twentyten/style.css could save 4.6KiB (22% reduction). See optimized version or Save as.
    * Minifying http://mysite/wp-content/plugins/nextgen-gallery/css/nggallery.css?ver=1.0.0 could save 1.9KiB (29% reduction). See optimized version or Save as.
    * Minifying http://mysite/wp-content/plugins/nextgen-gallery/shutter/shutter-reloaded.css?ver=1.3.0 could save 339B (21% reduction). See optimized version or Save as.
    * Minifying http://mysite/wp-content/plugins/wp-syntax/wp-syntax.css could save 171B (23% reduction). See optimized version or Save as.
    * Minifying http://mysite/wp-content/plugins/contact-form-7/styles.css?ver=2.2.1 could save 168B (19% reduction). See optimized version or Save as.

    I have also confirmed this outcome with another browser (all server & browser caches cleared first).

    Main html page content tells me:

    `<!– W3 Total Cache: Minify debug info:
    Engine: disk
    Theme: f7d1ed
    Template: index
    –>`

    I don’t know what is the best way to proceed, so I’m asking for feedback from other user experiencing the same problem.

    It might help if you provide a list of the plugins you are using so we rule those out as a possible cause. Please let me know if i need to provide more information to find the possible bug or how to adapt my configuration.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I cannot get my CSS (and probably also JS files) to get minified.

    What happens when you try? Does the replacement .css file get created or do you just get an error message?

    Not all files can be minify’ed. Also a link would help.

    What happens when you try? Does the replacement .css file get created or do you just get an error message?

    Not all files can be minify’ed. Also a link would help.

    So you say a replacement .css file should have been created? That doesn’t happen on my server (though the webserver process has permission to write in all folders including the themes folder). When I enable feedback via mail, I do get an error now and then saying nothing more then “241” in the body.

    Besides, I don’t see the links to the .css files in my HTML header get replaced by optimized surrogates, so it looks like the minify plugin is not interfering at all.

    Maybe it’s an issue with the Twenty Ten theme that I’m using?

    This is the WordPress blog where I’m talking about:
    http://blog.hendricksen.eu

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    So you say a replacement .css file should have been created?

    Yep. Look at my blog’s http://blog.dembowski.net/wp-content/w3tc-blog.dembowski.net/min/hybrid/mostlyharmless-hybrid/default.include.4062838792.css file.

    That file (or imaginary file, I have not looked to see if it exists or is just dynamically there) was created by W3TC. It’s the combination of the following URLs

    http://blog.dembowski.net/wp-content/themes/mostlyharmless-hybrid/style.css
    http://blog.dembowski.net/wp-content/plugins/cleaner-gallery/cleaner-gallery.css?ver=0.7
    http://blog.dembowski.net/wp-content/plugins/deko-boko-a-recaptcha-contact-form-plugin/display/dekoboko.css?ver=1.2.2

    Which works for me. I had to tell the plugin to minify those explicitly. Not all CSS worked; my plugin’s CSS files don’t like being minify’ed and did not work.

    In your blog’s HTML I don’t see a reference to the minify’ed replacement. You need to select the CSS to minify it.

    Jan, thank you for your feedback!

    First, to exclude the WordPress Twenty Ten theme from being the cause of the problem I have switched to the theme ‘WordPress Classic 1.5 by Dave Shea’ for the next tests.

    In your blog’s HTML I don’t see a reference to the minify’ed replacement. You need to select the CSS to minify it.

    I have added the following relative url’s to the list of CSS files to be combined & minimized:

    • wp-content/themes/twentyten/style.css
    • wp-content/plugins/nextgen-gallery/css/nggallery.css
    • wp-content/plugins/nextgen-gallery/shutter/shutter-reloaded.css
    • wp-content/plugins/wp-syntax/wp-syntax.css
    • wp-content/plugins/contact-form-7/styles.css

    That doesn’t generate a minified css file anywhere for as far as I can tell (the link-tag in the html-header does not get modified). But maybe you are right, and some files css files are interfering with the process, so, for testing purposes I have reduced to list to just the ‘wp-content/themes/twentyten/style.css’. That didn’t help either.

    Then I used the provided Help button. I added all the css files (36), applied changes, cleared caches (in browser as well), refreshed pages and – you guess it – no modifications of any link-tag in the html-header 🙁

    I have also checked & modified my .htaccess file so it contains only W3 Total Cache stuff and the default pretty url stuff from WP itself. I don’t think this file could be the cause of the problem because the minify CSS feature does not rely on the content of the .htaccess file to modify the HTML-file, I think.

    I’m running out of ideas. Maybe I should do a clean install of WordPress 3 with only the W3 Total Cache plugin. If that works I could slowly expand it with plugins to make it look like my current blog. I’ll report back to this thread whether that was successful.

    Moderator Jan Dembowski

    (@jdembowski)

    Forum Moderator and Brute Squad

    I couldn’t get relative paths for my CSS to work so I modified the wp-content/w3-total-cache-config-YOUR-HOSTNAME-HERE.php file and replaced the relative paths in that file with explicit paths.

    Then minify’ing the CSS worked. To make sure I retrieved the correct CSS paths, files, and arguments I examined my site in with Pingdom’s Tools and used the CSS links listed there as a guide.

    I’ve modified the wp-content/w3-total-cache-config.php file and changed all relative url’s to absolute ones. Then I tested it with the Pingdom’s Tools site (nice site btw), but again no luck with the minify for either CSS and JS.

    Besides I have tried to disable *all* plugins on my blog except for W3 Total Cache but that didn’t magically enable CSS and JS minification. That pretty much rules out all other plugins for being a cause of the problem.

    Another issue that I did find was in my Apache configuration. In the configuration file for my site, I had not used the DocumentRoot setting, but only the Alias. This gave an error when running the compatibility check (it referred to ‘/htdocs instead of the full document path on the webserver)’, but that is also fixed now (I’m using DocumentRoot now).

    Minor detail: my w3-total-cache-config-YOUR-HOSTNAME-HERE.php was named ‘w3-total-cache-config.php’, without the ‘-YOUR-HOSTNAME-HERE’.

    Morpheus4you, did you get to combine the CSS and JS using w3tc?
    I have just 2 files in the wp-content/w3tc/min folder with permissions set to 644:
    .htaccess
    index.php

    What do i need to get it working?

    Hi all

    I’ve got exactly the same problem going on here. Not sure what I need to do and struggling! Minifying JS is working … minifying CSS is not working – no file created in the correct directory.

    It cannot be server-based folder/file access – the W3TC plugin has created folders and files in those folders everywhere else. Sounds like a bug in the app is causing the minifed CSS to not be created due to a unique/non-tested set of circumstances.

    Would be good to crack here for all of us, and to help Frederick within the app build.

    Mark

    Hi there

    @jan – Just want to make sure I understand what you’ve done, as I cannot get your suggestion working …

    In the plugins/w3-total-cache folder, I amended the file w3-total-cache.php as follows:

    //require_once dirname(__FILE__) . ‘/inc/define.php’;
    require_once ‘c:\wamp\www\wp-content\plugins\w3-total-cache\inc\define.php’;

    and

    //require_once W3TC_DIR . ‘/lib/W3/Plugin/TotalCache.php’;
    require_once ‘c:\wamp\www\wp-content\plugins\w3-total-cache\lib\W3\Plugin\TotalCache.php’;

    It’s made no difference – both times, get a minified filename put into the HTML HEAD, and have the correct CSS files removed … but the minifed file itself is not created.

    Mark

    I have the same issue, did you ever work this out? Occasionally the minified file is created, but it never replaces the original css or loads.

    Hi there

    Nope, not yet.

    I spoke with Frederick, the owner, a few days ago though and he’s suggested we try disabling rewrite URL for minify.

    I’ve not had a chance to try this yet, as I’ve been up to my neck in other codework but if you give it a shot and get a result, could you post back here please?

    Mark

    Hi there

    By the way – just given this a go here, and it’s a no go 🙁

    Will keep trying. If you (or anyone) gets anywhere, please post back!

    Cheers

    Mark

    Yeah, I have very weird behavior.

    If I uncheck ‘rewrite URL’, then it doesn’t work AND (since I’m using CDN) it won’t give an option to upload the minifiy to CDN.

    I also have an issue if I uncheck CDN it won’t create minify file. If I have it checked, it will create it, but it never gets served.

    HTML minify also doesn’t work for me I don’t believe. The page line breaks and such aren’t removed.

    i can’t upload minify files. i click ‘start’ and nothing happens

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Plugin: W3 Total Cache] Cannot minify CSS files’ is closed to new replies.