由于在生产模式下缺少jquery文件,加载页面非常慢

时间:2014-04-14 02:21:05

标签: ruby-on-rails

我使用Nginx + Passenger + Rails 3来运行我的网站,

然而,页面的加载时间太长。

我使用chrome检查器来查看问题,它显示我缺少一个jQuery文件?

我怎么解决?

enter image description here

这是Gemfile

source 'http://rubygems.org'

gem 'rails', '3.2.12'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'
gem 'nokogiri'
# add will_paginate
gem 'will_paginate', '~> 3.0'


# Gems used only for assets and not required
# in production environments by default.
#group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'bootstrap-sass', '~> 2.3.2.0'
  gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
  gem 'jquery-datatables-rails', github: 'rweng/jquery-datatables-rails'
  gem 'jquery-ui-rails'
#end
gem 'hirb-unicode'
gem 'jquery-rails'
gem 'carrierwave'
# gem 'sidekiq'

#URL Command list
gem 'awesome_print', :require => 'ap'
gem 'quiet_assets', :group => :development

gem 'rails-erd', :group => :development

gem 'tinymce-rails'
gem 'haml'

#https://github.com/andi/simple-navigation/wiki/Installation
gem "simple-navigation"
#https://github.com/pdf/simple-navigation-bootstrap
gem 'simple-navigation-bootstrap'


#gem 'open-uri'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

gem 'pg'
gem 'taps'

gem 'devise'

#http://stackoverflow.com/questions/6379950/gmail-smtp-with-rails-3
#gem 'tlsmail'

gem 'cancan'

gem 'pry'
gem 'pry-remote'
gem 'pry-nav'
gem 'ipaddress'
# https://github.com/collectiveidea/delayed_job
# gem 'delayed_job_active_record'
# gem 'daemons'

gem "resque"
gem 'resque_mailer'
gem 'resque-scheduler'

gem 'rubyzip'


gem 'whenever', :require => false

1 个答案:

答案 0 :(得分:0)

查看您的清单文件(app / assets / javascripts / application.js)。可能你有什么不对劲。文件的顺序很重要:

//= require jquery
//= require jquery_ujs
//= require bootstrap-select
//= require twitter/bootstrap
//= require turbolinks
//= require jquery.ui
....

或者在config / environments / production.rb

中查看您的配置
  config.cache_classes = true
  config.eager_load = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.cache_store = :dalli_store
  #config.cache_store = :mem_cache_store

  config.serve_static_assets = false
  config.assets.compress = true
  config.assets.compile = true
  config.assets.digest = true