Title: CSS Optimization incorrectly concatenating certain properties
Last modified: August 31, 2016

---

# CSS Optimization incorrectly concatenating certain properties

 *  Resolved [carami](https://wordpress.org/support/users/carami/)
 * (@carami)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/css-optimization-incorrectly-concatenating-certain-properties/)
 * Hello,
 * I’m experiencing a CSS issue since updating Autoptimize to 2.0.0 on my local 
   site and our staging site. I have not updated on our live site and this issue
   isn’t present on 1.9.4.
 * I have a CSS rule that reads “flex: 0 1 calc(50% – 86px);” in my original CSS
   file.
 * When I use Autoptimize to optimize the CSS, it concatenates this property to “
   flex:0 1calc(100% – 86px);”, removing the space between 1 and the calc and breaking
   the flex property’s value.
 * I have noticed that in the case of, say, “flex: 0 1 112px;”, it concatenates 
   to “flex:0 1 112px;”, so there seems to be confusion with calc used as the flex-
   basis in shorthand flex.
 * [https://wordpress.org/plugins/autoptimize/](https://wordpress.org/plugins/autoptimize/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/css-optimization-incorrectly-concatenating-certain-properties/#post-6917824)
 * I tested and can confirm the regression, I’ll look into this.
 * frank
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/css-optimization-incorrectly-concatenating-certain-properties/#post-6917847)
 * OK, think I’ve [fixed this in the development version](https://github.com/futtta/autoptimize/commit/41bbab738950d8daeb2bc559f06228f1d2470ce7).
 * Feel free to try that by either:
    * overriding your plugins/autoptimize folder
   content [with this zip-file](https://github.com/futtta/autoptimize/archive/master.zip)*
   or to open up wp-content/plugins/autoptimize/classes/external/php/yui-php-cssmin-
   2.4.8-4_fgo.php and on line 268 replace
 *     ```
       $css = preg_replace_callback('/flex\s?:\s?([0-9 %]*(?:auto)?)/i',array($this, 'replace_flex'),$css);
       ```
   
 * with:
 *     ```
       $css = preg_replace_callback('/flex\s?:\s?((?:[0-9 ]*)\s?(?:px|em|auto|%)?(?:calc\(.*\))?)/i',array($this, 'replace_flex'),$css)
       ```
   
 * would be great if you could test & confirm if OK.
 * frank
 *  Thread Starter [carami](https://wordpress.org/support/users/carami/)
 * (@carami)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/css-optimization-incorrectly-concatenating-certain-properties/#post-6917931)
 * I applied this change, cleared the cache, and it’s working now. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘CSS Optimization incorrectly concatenating certain properties’ 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/)

 * 3 replies
 * 2 participants
 * Last reply from: [carami](https://wordpress.org/support/users/carami/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/css-optimization-incorrectly-concatenating-certain-properties/#post-6917931)
 * Status: resolved