digitalsparky / jekyll-minifier

Jekyll HTML/XML/CSS/JS Minifier utilising yui-compressor, and htmlcompressor
GNU General Public License v3.0
245 stars 25 forks source link

Inline Data URI, SVG XML loses whitespace #41

Open danielhaim1 opened 6 years ago

danielhaim1 commented 6 years ago

I identified an issue with the minifier which removes whitespace from Data URI.

Input (expected results):

background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E");

The minifier strips the whitespace, thus breaking it, output:

background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0045'%3E%3Cpathfill='%23343a40'd='M20L02h4zm05L03h4z'/%3E%3C/svg%3E");
bbbenji commented 5 years ago

There are 3 issues open for YUI regarding this. However, this plugin replaced YUI with Uglifier and cssminify2. I can't find an issue in either project about this, which is probably where it belongs.

Having said that, I too am experiencing this problem.

EDIT: Fixed here: https://github.com/bbbenji/cssminify/commit/3fe1f665720edd4a94da80337cb1f263acbcc548