2011-11-30 160 views
2

我使用Heroku Cedar堆栈来处理Rails应用程序,并且希望它能够在编译slu during期间预编译资源,因为我不想在git中编译预编译的东西。Heroku预编译资产没有结果

现在接缝,一切都应该没问题,因为塞在编译过程中记录说:

Preparing app for Rails asset pipeline 
     Running: rake assets:precompile 
     /usr/local/bin/ruby /tmp/build_8bg62ph22vwj/vendor/bundle/ruby/1.9.1/bin/rake assets:precompile:nondigest RAILS_ENV=production RAILS_GROUPS=assets 

但是当我尝试访问该网站在heroku logs我得到:

2011-11-30T08:23:52+00:00 app[web.1]: ActionView::Template::Error (blueprint/screen.css isn't precompiled): 
2011-11-30T08:23:52+00:00 app[web.1]:  22: <%= javascript_include_tag 'http://html5shiv.googlecode.com/svn/trunk/html5.js' %> 
2011-11-30T08:23:52+00:00 app[web.1]:  23: <![endif]--> 
2011-11-30T08:23:52+00:00 app[web.1]:  24: <%= javascript_include_tag 'application' %> 
2011-11-30T08:23:52+00:00 app[web.1]:  25: <%= stylesheet_link_tag  'blueprint/screen', :media => 'screen' %> 
… 

你有任何想法可以解决问题的地方?

回答

4

您是否尝试过在本地部署应用程序?如果是这样,你会得到相同的结果。

使用资产管道时,它默认通过application.css服务所有CSS。

您能够在您的样式表的标签更改为:

<%= stylesheet_link_tag 'application' %> 

如果在发展中正确显示,那么它也应该在生产工作。

或者,如果你真的需要直接包含这个文件,那么你将需要修改config/environments/production.rb补充:

config.assets.precompile += %w(blueprint/screen.css) 
+0

你是对的。我刚刚在webrick上进行了本地测试,我认为这些东西是“在运行时编译”的,因为所有东西都完美无瑕。 – Uko

0

多米尼克·汤森了问题绝对正确的信号源。至于解决方案here是在堆栈溢出的其他问题的答案非常好的选择。