【问题标题】:Rails assets are cached even in DevelopmentRails 资产即使在开发中也会被缓存
【发布时间】:2013-08-06 14:43:18
【问题描述】:

这是我的 Development.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
  config.assets.digest = true
  config.serve_static_assets = false

由于某种原因,即使在开发环境中,我的 CSS 文件也被缓存了,我不知道为什么

【问题讨论】:

标签: ruby-on-rails asset-pipeline


【解决方案1】:

遇到类似问题:Javascript 文件被 rails 服务器缓存

解决方案(如 TheIrishGuy 所述):

  1. 停止 Rails 服务器
  2. $rake tmp:cache:clear
  3. 启动 Rails 服务器
  4. 浏览器中的Crtl+F5

【讨论】:

    【解决方案2】:

    您是否预编译了任何资产?如果是这样,请检查公共资产文件夹并删除。

    尝试清除 /tmp/cache/assets

    确保浏览器没有缓存 application.css、强制刷新等

    【讨论】:

    • 我已经清除了所有内容,每次删除 tmp/cache/assets 目录时,我的应用都会重新创建它...
    • 在开发中,正在读取每个资产的指纹版本
    猜你喜欢
    • 2016-10-09
    • 1970-01-01
    • 2014-05-23
    • 2011-12-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-25
    • 2013-06-02
    相关资源
    最近更新 更多