2

我是一个 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
4

1 回答 1

1

检查你的production.rb那个............config.serve_static_assets = true也默认情况下assets:precompile不会css/js处理/vendor/assets. 在production.rb您可以使用config.assets.precompile获取css/j资产预编译处理的其他 s 文件config.assets.precompile += %w[ bootstrap/*.css bootstrap/*.js ]然后 rake assets:precompile 将处理它们,它们将在 heroku 上工作

于 2013-08-28T06:34:20.053 回答