2011-11-30 119 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是在堆棧溢出的其他問題的答案非常好的選擇。