Serving assets is very slow in development

喜夏-厌秋 提交于 2019-12-03 20:32:40

Another option - HDD isn't fast enough for logs, just bump into this (suddenly) on my dev pc. Try to set this into config/development.rb:

# Expands the lines which load the assets
config.assets.debug = false #true

If you have a lot of assets, each one take the time to write into dev log, adding up to several minutes total.

There is an issue in chrome where the browser tries a dns request and waits for a timeout (you can see in the developer tools / network tab if you hover on the colored timelines, it says waiting (30000ms or higher), receiving (4ms).

In the case you are soing something like this: 127.0.0.1 localhost.mysite.com in hostfile, and access http://localhost.mysite.com in the browser), you might try to just access it with localhost on port 80:

  • Start rails with rvmsudo rails server -p 80
  • Access http://localhost in chrome

That might solve the issue.

Precompile your assets and enable asset pipelining for development env. This may however not load the changes that you make in your source code without restarting the server.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!