Title: Zero Lenght File with CSS optimization
Last modified: August 21, 2016

---

# Zero Lenght File with CSS optimization

 *  Resolved [birdy](https://wordpress.org/support/users/ozum/)
 * (@ozum)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/)
 * Hello,
 * First of all, thanks for your hard work with this plugin.
 * I’m using your plugin (3.7.1) in two hosts. In one of them it works very well,
   but I couldn’t use CSS optimization on wpengine.com (see [http://ozum.wpengine.com](http://ozum.wpengine.com))
 * On both host I have the same site (exact clone).
 * On FTP I see 3 css cache files (25 Bytes, 71 Bytes, Zero Byte). It should many
   KB. When I try to optimize JS it generates js file correctly. So there isn’t 
   permission issue.
 * define(“AUTOPTIMIZE_LEGACY_MINIFIERS”,”true”); trick didn’t work either.
 * Strangely plugin works very well on a fresh installed site on wpengine, but stops
   after migration. I tried to disable all plugins except autoptimize and same thing
   happened.
 * In summary:
    1. On host A: With full site: WORKS 2. On wpengine: Default fresh
   WP install + autoptimize: WORKS 3. On wpengine: After migration full site: CSS
   DOES NOT WORK, JS WORKS 4. On wpengine: After migration full site, disable all
   plugins: CSS DOES NOT WORK, JS WORKS 5. On wpengine: Default fresh WP install
   + autoptimize install + migrate full site without plugins/autoptimize and without
   cache folder: CSS DOES NOT WORK, JS WORKS
 * Can you please help,
 * Regards,
 * [http://wordpress.org/plugins/autoptimize/](http://wordpress.org/plugins/autoptimize/)

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/page/2/?output_format=md)

 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321044)
 * That’s very weird, nothing comes to mind really. Can you check permissions on
   your CSS-files (and directories in which those live)?
 *  Thread Starter [birdy](https://wordpress.org/support/users/ozum/)
 * (@ozum)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321047)
 * After cleared cache confirming there is no file then refreshed page:
 * (I shortened file names for easy read.)
    File Permission Group Owner Size cache
   775 33 33 cache/autoptimize 775 33 33 cache/autoptimize/XXX.js 664 33 33 137KB(
   correct) cache/autoptimize/AAA.css 664 33 33 71B (broken) cache/autoptimize/BBB.
   css 664 33 33 0 (broken)
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321050)
 * OK, and how about the “source css”-files (i.e. those that autoptimize aggregates)?
 *  Thread Starter [birdy](https://wordpress.org/support/users/ozum/)
 * (@ozum)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321053)
 * I disabled autoptimize, so you can see them with firebug.
 * I have three sites:
    [http://www.fortibase.com](http://www.fortibase.com) (autoptimize
   enabled and works well) ozum.wpengine.com (autoptimize disabled you can see all
   css) murat.wpengine.com (autoptimize enabled without any other plugin, so fewest
   CSS)
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321065)
 * 1. can you temporarily disable AO on fortibase.com as well?
    2. can you check
   the rights on the “source css”-files?
 *  Thread Starter [birdy](https://wordpress.org/support/users/ozum/)
 * (@ozum)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321075)
 * 1. I disabled AO on frotibase.com
    2. I checked theme’s css permissions are 664
 * On wpengine I temporarily switched to thirteen theme and AO worked for CSS. When
   I switch back to Kickstart theme it stopped working. But as I told you same theme
   works on other host.
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321116)
 * 1. you can switch AO back on on fortibase.com
    2. are all autoptimized CSS-files
   empty on murat.wpengine.com?
 * up until now I have absolutely no idea what is going on, I’m afraid. The combination
   of wepengine + kickstart seems to be troubling for AO, but …
 * I’ll go over the code to see if I can add some extra error-handling in the near
   future, but you might have to live without CSS optimization on wpengine for now.
 *  Thread Starter [birdy](https://wordpress.org/support/users/ozum/)
 * (@ozum)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321123)
 * No, there are 3 CSS.
 * 2 of them is very short 25 Bytes and 71 bytes with contents below:
    1. html{margin-
   top:28px !important}* html body{margin-top:28px !important} 2. #wpadminbar{display:
   none}
 * Those are same in both working and non-working site. So I assume they created
   correctly.
 * Third one is zero byte, which should 150-200 KB according to working site.
 * Thank you for your kind help and for this great plugin.
 * Benchmarks based on my experiences:
    For CSS, I have better results than I have
   with W3 Total cache. W3TC created more files/requests. For JS AO created less
   files/requests than W3TC, but my site didn’t worked well with AO, but woked with
   W3TC. However I use Cloudflare for JS, because their rocketloader is fascinating.
 *  Thread Starter [birdy](https://wordpress.org/support/users/ozum/)
 * (@ozum)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321135)
 * I trapped the problem in one statement:
 * I use a child theme. In the child theme’s style.css I call parent theme’s style.
   css with following standard statement:
 * [@import](https://wordpress.org/support/users/import/) url(“../kickstart/style.
   css”);
 * If I delete [@import](https://wordpress.org/support/users/import/) statement,
   AO works as expected. This happens only on wpengine.com. In other host, this 
   does not cause any problems.
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321156)
 * Given that it works on your other host (and it should, imports are indeed managed
   in wp-content/plugins/autoptimize/classes/autoptimizeStyles.php starting from
   line 157, I test with multiple themes, many of which do CSS imports), my gut 
   feeling says must have something to do with rights somehow anyhow …
 * If you’re familiar with PHP, you could add some debugging in autoptimizeStyles.
   php to see what is going on, e.g.;
 *     ```
       $this->ao_logger("import CSS url: ".$url);
       ```
   
 * on line 167 or
 *     ```
       $this->ao_logger("import CSS path: ".$path);
       ```
   
 * a couple of lines below. Those debug-calls should create a file in /wp-content,
   which might help in understanding where things fail?
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321259)
 * I’ve just pushed a first test-version of 1.7.2 to the plugin repository. It _should_
   fix the CSS-import problem. You can [download the test-version here](http://downloads.wordpress.org/plugin/autoptimize.zip).
   Looking forward to your feedback!
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321261)
 * 1.7.2 is now released, hope it fixes the weird zero-length problem on WPEngine.
 *  Thread Starter [birdy](https://wordpress.org/support/users/ozum/)
 * (@ozum)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321267)
 * Dear futtta,
 * Since I don’t know PHP I cannot test autoptimizeStyles.php.
 * I tested 1.7.2, and unfortunately 1.7.2 does not solve zero-length problem on
   WPEngine.
 * Anyone else having same problem, here is my temporary solution:
 * I removed [@import](https://wordpress.org/support/users/import/) url(“../kickstart/
   style.css”); from CSS files and requested that file from PHP generated HTML files
   like:
 * <link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_directory’); ?>/../kickstart/
   style.css” type=”text/css” />
 * Although it is not a best practice for WordPress, autoptimize works well with
   this on wpengine. This problem doesn’t appear on other hosts, so I can live with
   that solution.
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321268)
 * Thanks for the feedback Ozum.
 * Pretty disappointed the extra checks for import-rules in 1.7.2 did not fix this.
   No idea what WPengine is so different at WPengine that imports don’t work there(
   and hence no idea how to solve).
 * Good to know there is a workaround, thanks for that (I’ll add a reference to 
   it in the FAQ)!
 *  Thread Starter [birdy](https://wordpress.org/support/users/ozum/)
 * (@ozum)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/#post-4321269)
 * Thank you for your effort.
 * For your F.A.Q.
 * I added that line to header.php and some themes have header-xxx.php where xxx
   is several types of header files. One should add the line below all of the header
   files and add his/her theme name instead of [THEME FOLDER HERE]
 * <link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_directory’); ?>/../[THEME
   FOLDER HERE]/style.css” type=”text/css” />
 * Regards,

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/page/2/?output_format=md)

 The topic ‘Zero Lenght File with CSS optimization’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

## Tags

 * [wpengine](https://wordpress.org/support/topic-tag/wpengine/)

 * 17 replies
 * 2 participants
 * Last reply from: [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/zero-lenght-file-with-css-optimization/page/2/#post-4321280)
 * Status: resolved