How to give fingerprint css path in production rails 4

前端 未结 1 1131
一向
一向 2020-12-18 09:03

I am using imgkit to take snapshot of my webpage. I run:

RAILS_ENV=production bundle exec rake assets:precompile To precompile my assets.

相关标签:
1条回答
  • 2020-12-18 10:05

    You can use Sprockets::Rails::Helper#asset_digest_path, found here. Since you are in the controller, you have access to it with

    self.class.helpers.asset_digest_path('application.css')
    # => "application-7a23a105125768e41d9d24aee4553615.css"
    

    Similarly, asset_path will yield the path to the application.css file

    self.class.helpers.asset_path('application.css')
    # => "/assets/application-7a23a105125768e41d9d24aee4553615.css"
    
    0 讨论(0)
提交回复
热议问题