jekyll-minifier icon indicating copy to clipboard operation
jekyll-minifier copied to clipboard

Problem with calc() minify (bis)

Open pfdt opened this issue 3 years ago • 5 comments

CSS minifying is breaking calc() function removing the needed spaces. It the same problem explained here : https://github.com/digitalsparky/jekyll-minifier/issues/5

And still a problem in last version (0.1.10)

pfdt avatar Sep 02 '20 06:09 pfdt

Also suffering same issue where spaces from the CSS calc() function are being removed making the style fail.

Example:

max-width: calc(100% + 40px);

is output as

max-width: calc(100%+40px);

which doesn't work. I have tried a "workaround"

max-width: calc(100% - - 40px);

which also doesn't work.

I've had to remove jekyll-minifier from my build.

thetwopct avatar Dec 03 '20 10:12 thetwopct

Ran into the same issue. Fixed it with this little patch:

--- vendor/bundle/ruby/2.6.0/gems/cssminify2-2.0.1/lib/cssminify2/cssmin-orig.rb	2021-02-20 22:16:46.000000000 +0100
+++ vendor/bundle/ruby/2.6.0/gems/cssminify2-2.0.1/lib/cssminify2/cssmin.rb	2021-02-20 22:16:41.000000000 +0100
@@ -212,2 +212,6 @@
     css = css.gsub(/(:|\s)0+\.(\d+)/) { "#{$1.to_s}.#{$2.to_s}" }
+
+    #
+    # Put space back between ' + ' i. e. in calc() operations
+    css = css.gsub(/\+/i, ' + ')

wneessen avatar Feb 20 '21 21:02 wneessen

Any update on this? Still a big issue

jordikitto avatar Aug 25 '21 23:08 jordikitto

I also ran into this recently. Didn't appear to be an issue on Firefox, but broke on Edge and Safari because there wasn't space on both sides of a - operator. Was only able to fix it by turning CSS minification completely off in _config.yml.

tallcoleman avatar Mar 24 '23 21:03 tallcoleman