【问题标题】:Images loading slowly (15+ seconds) in development?图像在开发中加载缓慢(15 秒以上)?
【发布时间】:2013-09-01 19:28:31
【问题描述】:

在我的 config/environment/development.rb 文件中,我发现了该设置:

config.assets.debug = false  # Debug mode disables concatenation and preprocessing of assets.

在使用大量 javascript 和 css 文件时大大加快了我的开发服务器的速度。

唯一的问题是加载图片时,开发服务器加载每张图片需要很长时间。服务器输出如下:

Started GET "/assets/shamcey/logo.png" for 10.0.2.2 at 2013-09-01 12:08:35 -0700


Started GET "/assets/shamcey/photos/thumb10.png" for 10.0.2.2 at 2013-09-01 12:08:36 -0700


Started GET "/assets/shamcey/leftpanelbg.png" for 10.0.2.2 at 2013-09-01 12:08:36 -0700


Started GET "/assets/shamcey/icons/message.png" for 10.0.2.2 at 2013-09-01 12:08:37 -0700


Started GET "/assets/shamcey/icons/users.png" for 10.0.2.2 at 2013-09-01 12:08:37 -0700


Started GET "/assets/shamcey/icons/bar.png" for 10.0.2.2 at 2013-09-01 12:08:38 -0700


Started GET "/assets/shamcey/droparrow.png" for 10.0.2.2 at 2013-09-01 12:08:38 -0700


Started GET "/assets/shamcey/bg1.png" for 10.0.2.2 at 2013-09-01 12:08:38 -0700


Started GET "/assets/shamcey/bcarrow.png" for 10.0.2.2 at 2013-09-01 12:08:39 -0700


Started GET "/assets/shamcey/bcarrow.png" for 10.0.2.2 at 2013-09-01 12:08:39 -0700


Started GET "/assets/shamcey/glyphicons-halflings.png" for 10.0.2.2 at 2013-09-01 12:08:39 -0700


Started GET "/assets/shamcey/icons/search.png" for 10.0.2.2 at 2013-09-01 12:08:40 -0700


Started GET "/assets/shamcey/icons/icon-event.png" for 10.0.2.2 at 2013-09-01 12:08:40 -0700


Started GET "/assets/shamcey/icons/icon-cart.png" for 10.0.2.2 at 2013-09-01 12:08:40 -0700


Started GET "/assets/shamcey/icons/icon-archive.png" for 10.0.2.2 at 2013-09-01 12:08:41 -0700


Started GET "/assets/shamcey/icons/icon-help.png" for 10.0.2.2 at 2013-09-01 12:08:41 -0700


Started GET "/assets/shamcey/icons/icon-images.png" for 10.0.2.2 at 2013-09-01 12:08:42 -0700


Started GET "/assets/shamcey/glyphicons-halflings-white.png" for 10.0.2.2 at 2013-09-01 12:08:42 -0700


Started GET "/assets/shamcey/calarrow.png" for 10.0.2.2 at 2013-09-01 12:08:42 -0700

有没有办法加快开发模式下的图片加载速度?

【问题讨论】:

    标签: asset-pipeline ruby-on-rails-4


    【解决方案1】:

    这解决了问题。

    config.cache_classes = true
    

    【讨论】:

      猜你喜欢
      • 2018-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多