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.
If assets are to be rebuilt in Production, production has to have access to minifiers. By default, Gemfile has something like this:
Need to remove
:group assets do, so these gems are included in production environment too. Then,find_assetrebuilds the asset and minimizes/compresses it on the first call, and caches it.