Rails 4 Asset Pipeline: Asset missing fingerprint in asset_path from js

后端 未结 2 1710

I am deploying a Rails 4.0 application which includes HTML partial templates as assets for our front-end javascript framework. Although these templates are part of the asset pip

相关标签:
2条回答
  • 2021-01-21 01:17

    This appears to be an issue with the AssetSync gem. I removed it, reconfigured the app so that Rails serves the assets, and the fingerprinting works fine.

    If anyone else finds this question and is running into the same issue, I would recommend against using AssetSync. According to Heroku:

    Many developers make use of Amazon’s S3 service for serving static assets that 
    have been uploaded previously, either manually or by some form of build process.
    Whilst this works, this is not recommended as S3 was designed as a file storage 
    service and not for optimal delivery of files under load. Therefore, serving 
    static assets from S3 is not recommended.
    

    Amazon CloudFront is the preferred method of serving assets through a CDN, and is very easy to configure with a Rails app that serves its own static assets, accomplishing the same goals as AssetSync.

    0 讨论(0)
  • 2021-01-21 01:17

    I'm pretty new to this stuff, but to get the asset_path to work, don't you need a .erb on the end of that file?

    Check out the bottom of this article for more info:

    https://devcenter.heroku.com/articles/rails-4-asset-pipeline

    If it works in development, that may not help. There is a helpful section on debugging at the bottom of the article though.

    Update

    Here's another article that could help:

    https://medium.com/self-directed-learning/9ba1f595102a

    Flipping on this configuration in Heroku made some of my asset pipeline problems go away:

    heroku labs:enable user-env-compile -a yourapp
    

    Hope this helps!

    Alex

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