Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3.2 and yui compressor

The Rails Guide on the asset pipeline says you can use the yui-compressor on CSS with:

config.assets.css_compressor = :yui

However, I see no sign that it is actually using it. For one, thing, it makes no difference whether or not I have the yui-compressor gem installed or not. For another, compressed output is the same whether I have that line or not.

I put a little debug line into actionpack-3.2.3/lib/sprockets/compressors.rb in the registered_css_compressor method, and this is the result when the css is compiled: #<Sass::Rails::CssCompressor:0x007fdef9f9fee0>

So it appears that the config line is not being honored. Has anyone actually used this option?

Update

Looking in sass-rails shows that the selection is overridden:

if app.config.assets.compress
    app.config.sass.style = :compressed
    app.config.assets.css_compressor = CssCompressor.new
end

If I comment that out, then it actually attempts to start the yui compressor... I'm still checking the output to see if it is correct.

like image 461
DGM Avatar asked May 20 '12 12:05

DGM


1 Answers

It truly is a bug in rails. I created a patch and pull request to fix it.

like image 130
DGM Avatar answered Oct 05 '22 01:10

DGM