2014-10-06 71 views
1

我使用的是Rubinius 2.2.10和Rails 4.1.6。javascript_include_tag在Rails 4.1中需要44秒的开发时间

自从rails 3.2升级以来,我的开发环境花费很长时间才会在javascript更改时加载链轮的javascript_include_tag。 44秒。在我development.rb(我用链轮,2.11.0)

有此选项:

# This option may cause significant delays in view rendering with a large 
# number of complex assets. 
config.assets.debug = true 

,但即使我将它设置为false,它需要的时间是相同的。

在应用程序(bootstrap和datatables)中存在一些公平的javascript,但它在Rails 3.2上从未花费那么长时间。任何想法,为什么会发生这种情况,以及如何加速备份?

这里是我的全部development.rb文件 -

require File.expand_path(File.join(File.dirname(__FILE__), 'environments_module.rb')) 
include EnvironmentsModule 

Rails.application.configure do #- Registration::Application.configure do 
    # Settings specified here will take precedence over those in config/application.rb 

    APP_CONFIG= YAML.load_file(File.join(Rails.root, "config", "calm_app.yml")) 

    config.communication_host_url = "http://localhost:3004" 

    # In the development environment your application's code is reloaded on 
    # every request. This slows down response time but is perfect for development 
    # since you don't have to restart the web server when you make code changes. 
    config.cache_classes = false 

    # Log error messages when you accidentally call methods on nil. 
    config.whiny_nils = true 

    # Do not eager load code on boot. 
    config.eager_load = false 


    # Show full error reports and disable caching 
    config.consider_all_requests_local  = true 

    #CACHING 
    # config.cache_store = :memory_store, { size: 64.megabytes } 
    config.cache_store = :mem_cache_store, {:pool_size => 5, :compress => true} 
    #not specifying a server above, this means memcache server is running on localhost on default port - this may not be ideal see the rails guide 
    config.action_controller.perform_caching = true 

    ## # Don't care if the mailer can't send 
    config.action_mailer.raise_delivery_errors = false 
    config.action_mailer.default_url_options = APP_CONFIG['invitation_mailer']['default_url_options'] 
    config.action_mailer.perform_deliveries = true 
    config.action_mailer.delivery_method = :sendmail 

    # Print deprecation notices to the Rails logger 
    config.active_support.deprecation = :log 

    config.active_record.migration_error = :page_load 

    #log ActiveRecord 
    ActiveRecord::Base.logger = Logger.new(STDOUT) if defined? Rails::Console 

    config.assets.js_compressor = Uglifier.new(mangle: false) # default is `true` in Rails 
    config.assets.debug = true 
    config.assets.raise_runtime_errors = true 

    config.middleware.use ExceptionNotification::Rack, 
    :email => { 
     :email_prefix => "[Exception]", 
     :sender_address => %{[email protected]}, 
     :exception_recipients => %w{[email protected], [email protected], [email protected]} 
    } 

    # auto rotate log files, keep 2 of 3MB each 
    config.logger = Logger.new(config.paths['log'].first, 1, 3*1024*1024) 
    config.log_level = :debug #:info 
    #this is the config for the bullet gem which helps to identify inefficient queries in development 
    config.after_initialize do 
    Bullet.enable = true 
    Bullet.bullet_logger = true # see results in log/bullet.log 
    end 

end 
+0

您是否在将它从true更改为false后重新启动服务器? – sevenseacat 2014-10-06 07:53:08

+0

是的,我很确定它会生效,因为我在设置为false时出现关于不可显示图像的错误。 – ryan2johnson9 2014-10-06 19:14:19

+0

似乎与[这个问题](http://stackoverflow.com/questions/15809218/serving-assets-is-very-slow-in-development)相关,除了他只有铬的问题,而我的问题是与所有浏览器我已经尝试过(firefox,chromium,safari)。 – ryan2johnson9 2014-10-07 00:05:37

回答

1

修正这种通过去除

config.assets.js_compressor = Uglifier.new(mangle: false) # default is `true` in Rails 
从配置/环境/ development.rb

我只需要它的生产反正所以没有理由在development.rb。