rails 3.2和对css文件的修改直到资产才反映:预编译

Kle*_* S. 6 ruby-on-rails ruby-on-rails-3

我正在创建一个新的rails 3.2项目,除了我在css文件上做的最后修改之外,一切都正常.

如果我确实app/assets/stylesheets/application.css对此文件进行了更改,那么在控制台上运行以下命令之前,我无法在浏览器上看到更改:

bundle exec rake assets:precompile RAILS_ENV=development

我的config/environment/development.rb档案.

Sample::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb

  # In the development environment your application's code is reloaded on
  # every request. This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Log error messages when you accidentally call methods on nil.
  config.whiny_nils = true

  # Show full error reports and disable caching
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  # Don't care if the mailer can't send
  config.action_mailer.raise_delivery_errors = false

  # Print deprecation notices to the Rails logger
  config.active_support.deprecation = :log

  # Only use best-standards-support built into browsers
  config.action_dispatch.best_standards_support = :builtin

  # Raise exception on mass assignment protection for Active Record models
  config.active_record.mass_assignment_sanitizer = :strict

  # Log the query plan for queries taking more than this (works
  # with SQLite, MySQL, and PostgreSQL)
  config.active_record.auto_explain_threshold_in_seconds = 0.5

  # Do not compress assets
  config.assets.compress = false

  # Expands the lines which load the assets
  config.assets.debug = true
end
Run Code Online (Sandbox Code Playgroud)

有帮助吗?

Kle*_* S. 16

问题是我编译了资产,因此rails正在为这些文件的已编译版本提供服务.

在这种情况下,您所要做的就是删除已经生成的文件,比如application.css和,application.css.gz并且您可以再次使用它.

希望它可以帮助某人.