与S3资产路径问题路径、资产、问题

2023-09-11 09:27:12 作者:温柔男

在生产,我使用Heroku和动态资源的S3。它工作正常。 现在,我尝试我的静态资产,发送到S3。我跟着这个教程 https://devcenter.heroku.com/articles/cdn-asset -host-rails31

In production, I use Heroku and dynamic assets on S3. It works fine. Now I try to send my statics assets to S3. I followed this tutorial https://devcenter.heroku.com/articles/cdn-asset-host-rails31

我加asset_sync宝石,我配置了我的Heroku ENVS,我的配置/ production.rb我跑的Heroku运行耙资产:precompile

I added asset_sync gem, I configured my heroku ENVs, my config/production.rb and I run heroku run rake assets:precompile

这似乎做工精细:


    Using: Directory Search of /app/public/assets
    Uploading: assets/application.js.gz
    Uploading: assets/application.css
    Uploading: assets/application-8977252f192f3e36dbd6b5142de920e3.css.gz
    Uploading: assets/eurof35-webfont-4ea19cda003d589e688cedcf9f79ddd6.eot
    Uploading: assets/application.css.gz
    Uploading: assets/application-8977252f192f3e36dbd6b5142de920e3.css
    Uploading: assets/application-a904f1bc7724b6f68e1f8d38d03a093e.js.gz
    Uploading: assets/application-a904f1bc7724b6f68e1f8d38d03a093e.js
    Uploading: assets/application.js
    AssetSync: Done.

然而,当我打开我的网站,没有CSS或JS文件。 当我检查code有 <链接HREF =htt​​p://s3.amazonaws.com/annoncestest/assets/application-85cc4376a5de3b224db7c0548a44e7cb.css媒体=所有相对=样式类型= 文本/ CSS/>

However when I load my website, there is no CSS or JS files. When I inspect the code there is <link href="http://s3.amazonaws.com/annoncestest/assets/application-85cc4376a5de3b224db7c0548a44e7cb.css" media="all" rel="stylesheet" type="text/css" />

正如你可以看到这就是所谓的CSS应用程序是不一样的,因为我有我的S3存储桶。

As you can see the CSS application which is called is not the same as I have in my S3 bucket.

你有什么想法?

编辑:不过它工作正常进行的application.js文件,它需要良好的文件。但不适合CSS文件(application.css和admin.css)。我试着用CloudFront的,结果是一样的。

EDIT : However it works fine for application.js file, it takes the good files. But not for css files (application.css and admin.css). I tried with CloudFront and the result is the same.

推荐答案

要收门票我终于找到了解决方案的感谢Heroku的帮助。 解决的办法是在这等票的Heroku为什么不使用很好的体现使用.yml

To close the ticket I finally found the solution thanks to Heroku help. The solution is in this other ticket Why Heroku don't use the good manifest.yml

我希望这将有助于!