tubalmartin / YUI-CSS-compressor-PHP-port

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

Named colors shortening is overly aggressive #39

Closed bertptrs closed 7 years ago

bertptrs commented 7 years ago

The named color renaming scheme (renaming things such as #FF0000 to red and white to #fff) is a tad too agressive, as it renames occurences everywheren.

In my particular case, it changes url(assets/images/white.png) into url(assets/images/#fff.png), which results in a 404. I suppose the regular expression attempting to rename these colors could be tweaked so that it only works on things that are actually colors, but I'm not sure how.

In the meantime, I'm working around this bug by renaming my file.

tubalmartin commented 7 years ago

Thanks for reporting! I will cover that case!

tubalmartin commented 7 years ago

Ummm which version of CSSmin are you using? It's working fine on v3.1.2

bertptrs commented 7 years ago

I'm using 2.4.8-p5, due to using this library indirectly (via mrclay/minify). I can confirm that it does not happen in v3.1.2.

I'll raise a ticket in the Minify project and hope they pick it up soon.

tubalmartin commented 7 years ago

Great! Closing this issue! Thanks for reporting anyway. I've added a test for it.