图像在开发中缓慢加载(15秒以上)?

时间:2013-09-01 19:28:31

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

在我的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

是否有加速在开发模式下加载图像的方法?

1 个答案:

答案 0 :(得分:0)

这解决了这个问题。

config.cache_classes = true