tubalmartin / YUI-CSS-compressor-PHP-port

A PHP port of the YUI CSS compressor.
230 stars 34 forks source link

CSS calc() problem #35

Closed Pyrazo closed 7 years ago

Pyrazo commented 7 years ago

if you have the following CSS code calc(612px + (100% - 1024px)/2) the css min function generates at the moment the following result: calc(612px +(100% - 1024px)/2). Because the whitespace are left over between the plus and the bracket, the css code is invalid. The problem is located in the replace_calc function. I have fixed it with the following code: $token = preg_replace('/\s*([\*\/\(\),])\s*/', '$1', $matches[2]); $token = preg_replace(['/(\S)([+-])/', '/([+-])(\S)/'], '$1 $2', $token); $this->preserved_tokens[] = trim($token);

Please fix this problem in the next Version :) Best regards

Pyrazo commented 7 years ago

my fault, was fixed in https://github.com/futtta/autoptimize/commit/685d76b44043c6ec8aee4414a433673a29bc3c56