1

我有两台机器,Machine1 工作得很好。Machine2 是我正在设置的新机器。Machine1 运行 OSX 10.6 Snow Leopard,Machine2 运行 OSX 10.8 Mountain Lion。我已经将我的项目上传到 Github,所以我应该能够(在 Machine2 上)安装 Xcode、homebrew、git、rvm、ruby、rails。然后,克隆项目、捆绑安装、rake 和瞧,对吧?

不,样式表没有加载。没有 CSS 样式,所以我检查浏览器,application.css显示:

/*
 * This is a manifest file that'll automatically include all the stylesheets available in this directory
 * and any sub-directories. 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 bootstrap_and_overrides
 *= require_tree  
 *= require jquery.ui.datepicker
 *= require jquery.facebox
*/

我是不是忘记了什么?我跑了rails generate bootstrap:install less,但还是没有骰子。由于某种原因,application.css 文件没有被解释。

我认为这可能是 Ruby 版本的问题,因为 Machine2 使用的是 Ruby 2.0 和 Machine1 Ruby 1.9.2,所以我在 Machine2 上安装了 1.9.2 但仍然没有问题。

这一切都处于开发模式。此外,在尝试解决问题时,我bootstrap_and_overrides在布局中包含了样式表,然后我有了一些样式!但这显然不是解决方案。

这里有一些配置:

宝石文件

source 'https://rubygems.org'

gem 'rails', '3.2.3'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'mysql2'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'twitter-bootstrap-rails'
  gem 'less-rails'
  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  gem 'therubyracer', :platform => :ruby
  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

发展.rb

Experts::Application.configure do

  config.cache_classes = false

  config.whiny_nils = true

  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  config.action_mailer.raise_delivery_errors = false

  config.active_support.deprecation = :log

  config.action_dispatch.best_standards_support = :builtin

  config.active_record.mass_assignment_sanitizer = :strict

  config.active_record.auto_explain_threshold_in_seconds = 0.5

  config.assets.compress = false

  config.assets.debug = true
end
4

1 回答 1

2

可能降级 less-rails 版本是一个选项,当我从 1.9.3 升级到 ruby​​ 2.0.0-p247 并更新所有 gem 时遇到了问题。在将 less-rails 降级到 2.3.3 后,我无法在生产中预编译,一切正常

于 2013-10-17T07:38:59.370 回答