digest_path & asset_digest_path not allowing digest URLs

后端 未结 1 994
隐瞒了意图╮
隐瞒了意图╮ 2021-01-28 23:49

I have been having this pretty rough time with assets on production. It came down to me trying to override the sprokets helper module to try and see what was up... When I re-wr

相关标签:
1条回答
  • 2021-01-28 23:57

    Hopefully this will help save my fellow programmer friends some head banging :D

    I was uploading the files to S3, I didn't realize that the manifest wasn't loaded by Rails. You can have all your production settings right (like above and in other threads), but if you don't have the manifest.json file readable by Rails, it will still generate /javascript/* (example) urls.

    I was still having trouble with multi_json gem's latest version, so I downgraded it to 1.7.8 and it works fine.

    gem 'multi_json', '1.7.8'
    

    That's so it can read the manifest.json file which rake assets:precompile creates.

    There is a debate on this sprockets thread https://github.com/rails/sprockets-rails/issues/107 on whether your manifest file should be in git or just on a deploy script, do what suits you best, just make sure it is findable in:

    /public/assets/manifest.json 
    

    or specifiy it yourself with

    config.assets.manifest = '...'
    

    That may or may not be depricated.

    Cheers!

    0 讨论(0)
提交回复
热议问题