matthodan / jekyll-asset-pipeline

Powerful asset pipeline for Jekyll that collects, converts and compresses JavaScript and CSS assets
http://www.matthodan.com/2012/11/22/jekyll-asset-pipeline.html
MIT License
364 stars 31 forks source link

CssCompressor fails to compress asset with a DATA-URI #3

Closed bndn closed 11 years ago

bndn commented 11 years ago

I use SASS ans Compass to generate a data-uri with the Compass method inline-image() and the command compass compile. The CSS file is generated then I call it in the css_asset_tag, but the JekyllAssetPipeline fails to compress the file depending of data. The following content is compressed :

.favicon{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAU1QTFRFAAAAdl9Fdl9Fdl9Fdl9Fdl9Fdl9Fdl9Fdl9Fdl9Fdl9Fdl9Fcl5F9o449Y039Y039Y44dl9Fdl9Fdl9FdV9FbVxGimZD9Y019o029ZE+9ZA89Yw09Y02dl9Fdl9Fdl9FcV1Gc15Fh2VE+ZVB+Ktp+rqC+rh/+Kdi9Y02dl9Fdl9Fdl9F9I02+ZI7+8+n+sKR9Y03dl9Fdl9F9owz96FY9pZF9Yw0dl9Fdl9F9Ys096FX9pdI9Yw0dl9Fdl9F/I4z951R/NKs9pI+9Y01dl9Fdl9F04E7+7uD+8aX+K1v9Y44dl9Fdl9Fdl9FdV9Fb11GbVxGsXM8+pZD+Khk+KZh+KZi9phJ9Yox9Y449Y44dl9Fdl9Fdl9Fc15FbVtGhGRE9o439osz9Yw09Yw09Yw19Y449Y449Y44dl9F0n849Y869Yw09Yw19Ysy////tCdKpAAAAGh0Uk5TANBR/Gr1ZvZdP2lZGyVSThzvjsH59XWa/Pn8+IHmyTMMGYDtVBYedYnt4A9X+zJeQvd8u7vrlfRkzJ7ZrNOhm9UR+KZjSTtyAqWeAqCfZnfT7dmLcnbO9PepZ9bz6aMgRsbs6Kwpo4Z+Zc+fAAAAAWJLR0RuIg9RFwAAAAlwSFlzAAA")}

but not this one, with only one more character ! :

.favicon{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAU1QTFRFAAAAdl9Fdl9Fdl9Fdl9Fdl9Fdl9Fdl9Fdl9Fdl9Fdl9Fdl9Fcl5F9o449Y039Y039Y44dl9Fdl9Fdl9FdV9FbVxGimZD9Y019o029ZE+9ZA89Yw09Y02dl9Fdl9Fdl9FcV1Gc15Fh2VE+ZVB+Ktp+rqC+rh/+Kdi9Y02dl9Fdl9Fdl9F9I02+ZI7+8+n+sKR9Y03dl9Fdl9F9owz96FY9pZF9Yw0dl9Fdl9F9Ys096FX9pdI9Yw0dl9Fdl9F/I4z951R/NKs9pI+9Y01dl9Fdl9F04E7+7uD+8aX+K1v9Y44dl9Fdl9Fdl9FdV9Fb11GbVxGsXM8+pZD+Khk+KZh+KZi9phJ9Yox9Y449Y44dl9Fdl9Fdl9Fc15FbVtGhGRE9o439osz9Yw09Yw09Yw19Y449Y449Y44dl9F0n849Y869Yw09Yw19Ysy////tCdKpAAAAGh0Uk5TANBR/Gr1ZvZdP2lZGyVSThzvjsH59XWa/Pn8+IHmyTMMGYDtVBYedYnt4A9X+zJeQvd8u7vrlfRkzJ7ZrNOhm9UR+KZjSTtyAqWeAqCfZnfT7dmLcnbO9PepZ9bz6aMgRsbs6Kwpo4Z+Zc+fAAAAAWJLR0RuIg9RFwAAAAlwSFlzAAAA")}

I do not understand what is the problem :/

matthodan commented 11 years ago

Interesting problem. Couple of questions: Which library are you using (e.g. Closure Compiler, YUI, etc.)? Can you compress the CSS file manually from the command line using this library? Is it throwing an error when you run the jekyll command?

bndn commented 11 years ago

I use YUI Compressor. Compressing the CSS file from the command line give an error too : YUI::Compressor::RuntimeError: compression failed. The error from Jekyll is Asset Pipeline: Compiling bundle...Failed to compress asset with 'JekyllAssetPipeline::CssCompressor'.

But I found that the problem is from YUI Compressor 2.4.4 included in ruby-yui-compressor. I tried with the version 2.4.7 from yuicompressor and it works.

And I’m not the only one that have this problem : https://github.com/sstephenson/ruby-yui-compressor/issues/19

I should have looked better before reporting a problem here :)