资产出了点问题-本地的每页加载都需要1.5分钟以上的时间 [英] Something's wrong with assets - each page in local takes over 1.5 mins to load

查看:77
本文介绍了资产出了点问题-本地的每页加载都需要1.5分钟以上的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从我移到active_admin以来,我的本地服务器花费了超过1.5分钟的时间来加载每个页面.我肯定做错了.

Since I moved to active_admin my local server takes over 1.5 minutes to load each and every page. I'm surely doing something wrong.

Development.rb

config.assets.compress = true; config.assets.debug = true; config.assets.compile = false; config.assets.digest = false

config.assets.compress = true; config.assets.debug = true; config.assets.compile = false; config.assets.digest = false

Production.rb

Production.rb

config.assets.compress = true; config.assets.compile = true; config.assets.digest = true; config.assets.precompile + = ['active_admin.js','active_admin.css']

config.assets.compress = true; config.assets.compile = true; config.assets.digest = true; config.assets.precompile += ['active_admin.js', 'active_admin.css']

请注意,编译在生产环境中是正确的,因为活动管理员无法正常工作.

Note the compile is true in production because active admin does not work other wise.

资产文件夹

-javascripts

--javascripts

----- active_admin.js

-----active_admin.js

----- application.js从//= require_tree ./myfolder/

-----application.js loads its files from //= require_tree ./myfolder/

----- myfolder

-----myfolder

---------- 1.js

----------1.js

---------- 2.js

----------2.js

----------....

----------....

-样式表

----- active_admin.css.scss

-----active_admin.css.scss

----- application.css.scss从* = require_tree ./myfolder/

-----application.css.scss loads its files from *= require_tree ./myfolder/

----- myfolder

-----myfolder

---------- 1.css.scss

----------1.css.scss

----------- 2.css.scss

----------2.css.scss

----------....

----------....

日志

似乎是由于每个资产文件的加载时间所致.我只列出第一个和最后一个.两者之间的时间差为1.5分钟.

Seems to be because of the load time of each of the assets files. I m listing only the first and last. The time difference between the two is 1.5 minutes.

在2011-10-24开始为127.0.0.1获取GET"/assets/jquery.js?body=1" 18:19:41 +0530投放的资产/jquery.js-200确定(4毫秒)

Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-10-24 18:19:41 +0530 Served asset /jquery.js - 200 OK (4ms)

在2011-10-24 18:21:04 +0530已投放资产/myfolder/vertical_menu中以127.0.0.1开始获取"/assets/myfolder/vertical_menu.css?body=1". css-200 OK(2ms)

Started GET "/assets/myfolder/vertical_menu.css?body=1" for 127.0.0.1 at 2011-10-24 18:21:04 +0530 Served asset /myfolder/vertical_menu.css - 200 OK (2ms)

我在做什么错?

推荐答案

development.rb的正确设置为:

The correct settings for development.rb are:


config.assets.debug = true; 
config.assets.compile = true;

您应该删除压缩线,因为这在时间上是非常昂贵的过程,并且可能是速度较慢的原因.

You should remove the compress line, as this is quite an expensive process time-wise and may be the reason it is slow.

我建议您查看资产管道Rails指南,因为它具有正确的设置升级的应用程序的配置文件,以及有关部署的一些提示.

I would suggest looking at the asset pipeline Rails guide as this has the correct settings for an upgraded app's config files, and some tips about deploying too.

如果您不需要对文件进行任何调试,则还可以删除调试.这将只提供一个文件,而不是多个文件.

If you don't need to do any debugging on the files you could also remove debug; this will serve just one files instead of many.

这篇关于资产出了点问题-本地的每页加载都需要1.5分钟以上的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆