0

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

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

4

1 回答 1

0

这解决了问题。

config.cache_classes = true
于 2013-12-17T21:21:06.767 回答