【问题标题】:Lost .scss in rails app staging version on HerokuHeroku 上的 rails 应用暂存版本中丢失 .scss
【发布时间】: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.rbenvironment.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 的问题没有改变。
  • 请看我的cmetsconfig.assets.compile = true

标签: ruby-on-rails heroku ruby-on-rails-3.1 sass staging


【解决方案1】:

检查您的production.rb 是否.........config.serve_static_assets = true 默认情况下assets:precompile 不会处理/vendor/assets 中的css/js 文件。在production.rb 中,您可以使用config.assets.precompile 来获取由资产precompileconfig.assets.precompile += %w[ bootstrap/*.css bootstrap/*.js ] 处理的额外css/js 文件然后rake assets:precompile 将处理它们,它们将在heroku 上工作

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-08-19
  • 2010-11-19
  • 1970-01-01
  • 2014-06-15
  • 1970-01-01
  • 1970-01-01
  • 2014-10-16
相关资源
最近更新 更多