2013-10-21 175 views
0

我無法解決生產環境的問題。我在heroku上的application.css是空的,而在開發過程中它很好。Rails和Heroku的資產管道

在我的application.rb中添加此: config.assets.enabled = true config.assets.compress = false ,但它仍然無法正常工作。

預編譯不起作用。在做完之後,heroku會發出一條消息,表明它已經找到了一個清單文件,但仍然無效。爲了回滾它,我使用了rake assets:clean。該消息仍然出現。

我該怎麼辦?我只有一個沒有JS的CSS文件。

鏈接到應用程序:我Application.css的 http://floating-hamlet-8270.herokuapp.com/

部分:

/* 
* This is a manifest file that'll be compiled into application.css, which will include all  the files 
* listed below. 
* 
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 
* 
* You're free to add application-wide styles to this file and they'll appear at the top of the 
* compiled file, but it's generally better to create a new file per style scope. 
* 
*= require_self 
*= require_tree . 
*/ 

html, body, h1, h2, h3, h4, h5, h6, p, ul, li { 
margin: 0; 
padding: 0; 
} 

body { 
font-family: "Noto Sans", sans-serif; 
} 

回答

0

請參閱從Heroku's documentation如下:

如果公共/資產/清單。 yml在您的應用程序中檢測到,Heroku將 假定您正在處理資產編譯,並且不會 試圖編譯你的資產。

您必須刪除您的manifest.yml文件才能讓Heroku管理您的資產或正確配置它。

+0

在這兩種情況下,推到Heroku的雲的權利,但文件是不是GETed通過瀏覽器。不幸的是,我在文檔中嘗試了一切,但樣式仍然沒有出現......是否有一種方法可以禁用Heroku中的鏈輪? –

0

請嘗試以下...

添加到Gemfile中:

寶石 'rails_12factor',組:生產

添加到/config/production.rb:

配置。 serve_static_assets = true

config.action_dispatch.x_sendfile_header ='X-Accel-Redirect'

config.assets.compile =真

https://medium.com/self-directed-learning/9ba1f595102a