How to inline compressed CSS in Rails with assets pipeline
        Posted  
        
            by 
                haimg
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by haimg
        
        
        
        Published on 2012-10-25T16:43:16Z
        Indexed on 
            2012/10/25
            17:00 UTC
        
        
        Read the original article
        Hit count: 277
        
I'm trying to inline CSS into my layout. I'm currently using
= Rails.application.assets.find_asset('embedded.css').body.html_safe
However, the CSS returned is not compressed. I verified what .digest_path asset file exists, and is properly compressed.
I can, of course, write a helper that will check if current on-disk compressed asset file exists for a given asset, and use it. However, I think find_asset actually compiles a CSS asset each time it is called -- not good in production. I hope a cleaner solution exists for this issue.
© Stack Overflow or respective owner