小编der*_*yau的帖子

heroku中的Asset_pipeline使用预编译的javascript的错误资产哈希

我正在尝试设置我的应用以通过Amazon S3/Cloudfront CDN提供资源.它是一个rails应用程序,我使用asset_syncgem来实现这个heroku文档.

我将我的项目推送到heroku,然后运行一个heroku run rake assets:precompile.这给了我看起来像这样的输出:

    I, [2013-09-20T21:19:06.506796 #2]  INFO -- : Writing /app/public/assets/application-cb6347d3ce9380e02c37364b541fd8ae.js
I, [2013-09-20T21:19:19.979570 #2]  INFO -- : Writing /app/public/assets/application-9dc3068c1bf9290c7eb0493fd36b3587.css
[WARNING] fog: followed redirect to abc123.s3-us-west-1.amazonaws.com, connecting to the matching region will be more performant
[WARNING] fog: followed redirect to abc123.s3-us-west-1.amazonaws.com, connecting to the matching region will be more performant
Run Code Online (Sandbox Code Playgroud)

请注意,它为JS文件写的哈希cb6347d3ce9380e02c37364b541fd8ae.js是正确的(因为我也在我的localhost下进行了暂存).

但问题是,当我在heroku上点击我的应用程序并检查源代码时,它所包含的JS与50460076f4c6eb614a44b6b17323efa7.js之前编译的JS 不同...

为什么heroku没有使用正确的预编译资产?我在本地部署并执行了所有相同的步骤,我的本地服务器没有问题就选择了正确的JS.

谢谢你的帮助!

heroku asset-pipeline amazon-cloudfront ruby-on-rails-4

5
推荐指数
1
解决办法
1237
查看次数