Title: CSS with nested calc broken
Last modified: January 15, 2021

---

# CSS with nested calc broken

 *  Resolved [retrovertigo](https://wordpress.org/support/users/retrovertigo/)
 * (@retrovertigo)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/css-with-nested-calc-broken/)
 * Hi there,
 * Just noticed that this (weird, but legal) CSS value breaks using the plugin
 * `calc(10px - calc(2rem / 2))`
 * though there is no reason to do that it is legal 😉
 * the plugin changes it to
 * `calc(10px - )calc(2rem / 2))`
 * adding an extra closing braket and breaking the value.
 * Not urgent as I could just simplify the calc function value, but wanted to let
   you know.
 * Examples:
    1. [https://stackoverflow.com/questions/27597034/calc-function-inside-another-calc-in-css#36414853](https://stackoverflow.com/questions/27597034/calc-function-inside-another-calc-in-css#36414853)
   2. [https://developer.mozilla.org/en-US/docs/Web/CSS/calc()#nested_calc_with_css_variables](https://developer.mozilla.org/en-US/docs/Web/CSS/calc()#nested_calc_with_css_variables)
    -  This topic was modified 5 years, 4 months ago by [retrovertigo](https://wordpress.org/support/users/retrovertigo/).

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

 *  Plugin Author [Gabe Livan](https://wordpress.org/support/users/gabelivan/)
 * (@gabelivan)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/css-with-nested-calc-broken/#post-13913159)
 * [@retrovertigo](https://wordpress.org/support/users/retrovertigo/) many thanks
   for letting me know about this bug! Indeed, it shouldn’t behave like that and
   apparently, nested “calc” is not something the CSS minifier used by the plugin
   likes.
 * For now, until a fix would be released, I advise you to stop minifying CS files
   that contain nested “calc”. To do that, you have to go to “_Settings_” -> “_Optimize
   CSS_” -> “_CSS Files Minification_” and then below “_Do not minify the CSS files
   matching the patterns below (one per line):_” there’s a textarea where you can
   add the exclusions.
 *  Plugin Author [Gabe Livan](https://wordpress.org/support/users/gabelivan/)
 * (@gabelivan)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/css-with-nested-calc-broken/#post-13913741)
 * [@retrovertigo](https://wordpress.org/support/users/retrovertigo/) **UPDATE:**
   I’ve released a patch on the development version that addresses the issue you
   mentioned and it shouldn’t happen again. You can use this patch (see instructions
   on how to get it here: [https://www.assetcleanup.com/docs/how-to-get-the-development-version-of-asset-cleanup/](https://www.assetcleanup.com/docs/how-to-get-the-development-version-of-asset-cleanup/))
   until the next tag will be released which will obviously have the fix. Thanks
   again for letting me know about this bug!
 *  Thread Starter [retrovertigo](https://wordpress.org/support/users/retrovertigo/)
 * (@retrovertigo)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/css-with-nested-calc-broken/#post-13914776)
 * So quick Gabe! Very impressive 🙂 Thanks
 *  Plugin Author [Gabe Livan](https://wordpress.org/support/users/gabelivan/)
 * (@gabelivan)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/css-with-nested-calc-broken/#post-13916045)
 * [@retrovertigo](https://wordpress.org/support/users/retrovertigo/) I’m glad I
   was able to help! Now, please test it out and let me know if the problem is still
   there. It shouldn’t be! In my tests, the `calc()` was preserved fine.
 * PS: If you’re happy with the plugin overall, it would be great if you can spare
   a minute and leave a quick review about it: [https://wordpress.org/support/plugin/wp-asset-clean-up/reviews/#new-post](https://wordpress.org/support/plugin/wp-asset-clean-up/reviews/#new-post)

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

The topic ‘CSS with nested calc broken’ is closed to new replies.

 * ![](https://ps.w.org/wp-asset-clean-up/assets/icon-256x256.png?rev=1981952)
 * [Asset CleanUp: Page Speed Booster](https://wordpress.org/plugins/wp-asset-clean-up/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-asset-clean-up/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-asset-clean-up/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-asset-clean-up/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-asset-clean-up/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-asset-clean-up/reviews/)

## Tags

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

 * 4 replies
 * 2 participants
 * Last reply from: [Gabe Livan](https://wordpress.org/support/users/gabelivan/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/css-with-nested-calc-broken/#post-13916045)
 * Status: resolved