简体   繁体   English

Rails 3.1 资产管道指纹

[英]Rails 3.1 Asset Pipeline Fingerprinting

Simple question:简单的问题:

I've got a Rails 3.1 app running in staging, which is RAILS_ENV=production .我有一个在暂存中运行的 Rails 3.1 应用程序,即RAILS_ENV=production My problem is this: stylesheet_link_tag produces a different fingerprint for my css files than the fingerprint that was produced by rake assets:precompile .我的问题是: stylesheet_link_tag为我的 css 文件生成的指纹与rake assets:precompile生成的指纹不同。

So when I request a page, the link to the stylesheet is looking for a file like:因此,当我请求页面时,样式表的链接正在寻找如下文件:

/assets/front-1e3a4454e0d5434eccac1a053ca4c7fd.css

but in reality the file sitting in public/assets is但实际上位于公共/资产中的文件是

front-60b624d69d97b3ac5f288c54245a5ed5.css

and the browser returns a 404 Not Found.并且浏览器返回 404 Not Found。

Here is my linlk stylesheet_link_tag:front .这是我的链接stylesheet_link_tag:front Can anybody explain to me why this happens?谁能向我解释为什么会这样?

I've been having the same exact issue.我一直有同样的问题。 Best I can tell, this occurs when the precompile task runs during a capistrano deploy.尽我所能,这发生在预编译任务在 capistrano 部署期间运行时。 I've had to remove the precompile from deployment and run the我不得不从部署中删除预编译并运行

rake assets:precompile RAILS_ENV=production from the release directory after the app has been deployed. rake assets:precompile RAILS_ENV=production 在应用程序部署后从发布目录。 It's a pain if you're pushing code frequently.如果您经常推送代码,那会很痛苦。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM