【发布时间】:2013-08-28 14:34:20
【问题描述】:
我是一个 Rails 菜鸟,我在 Heroku 上有一个 Rails 生产应用程序。 为了进行更审慎的部署前评估,我设置了一个 使用通常的暂存版本:
$ heroku create --remote staging
$ git push staging master
$ heroku run rake db:migrate --remote staging
$ heroku open --remote staging
当我启动登台应用程序时,它看起来很好,除了所有 css/scss 都没有运行。
我忽略了什么??
这是我的 environment.rb 文件:
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Usrochr::Application.initialize!
这是我的 production.rb 文件[我的 staging.rb 是一样的]:
Usrochr::Application.configure do
config.cache_classes = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.serve_static_assets = false
config.assets.compress = true
config.assets.compile = false
config.assets.digest = true
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
end
【问题讨论】:
-
能否请您发布您的
production.rb和environment.rb文件 -
这是我的 environment.rb 文件:
-
在哪里?....顺便检查一下您的production.rb .........
config.serve_static_assets = true也默认 assets:precompile 不会处理 css /vendor/assets 中的 /js 文件。在 production.rb 中,您可以使用 config.assets.precompile 获取资产 precompileconfig.assets.precompile += %w[ bootstrap/*.css bootstrap/*.js ]处理的其他 css/js 文件,然后rake assets:precompile将处理它们,它们将在 heroku 上工作。 -
谢谢-我尝试在 staging.rb 文件中设置 ..config.serve_static_assets = true 并且暂存版本未显示 scss/css 的问题没有改变。
-
请看我的cmets
config.assets.compile = true
标签: ruby-on-rails heroku ruby-on-rails-3.1 sass staging