我正在运行应用程序,一切都在开发中很好但在生产中(heroku)我有一些js文件的麻烦(没有正确加载jquery并使一些事情破坏)。
资产中的生产是否存在不同的称谓?也许有些文件在heroku应用程序中压缩时会覆盖其他文件。我只想在两种环境中获得相同的结果。
的application.js
//= require jquery
//= require jquery.turbolinks
//= require jquery-ujs/src/rails
//= require jquery-ui
//= require bootstrap-sass/assets/javascripts/bootstrap
...
development.rb
Rails.application.configure do
config.action_mailer.delivery_method = :letter_opener
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.cache_classes = false
config.eager_load = false
config.consider_all_requests_local = true
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800'
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_caching = false
config.active_support.deprecation = :log
config.active_record.migration_error = :page_load
config.assets.debug = true
config.assets.quiet = true
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = {host: "localhost:3000"}
end
production.rb
Rails.application.configure do
config.cache_classes = true
config.action_mailer.delivery_method = :smtp
config.eager_load = true
config.consider_all_requests_local = true
config.action_controller.perform_caching = true
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.assets.js_compressor = :uglifier
config.assets.compile = true
config.log_level = :debug
config.log_tags = [ :request_id ]
config.action_mailer.perform_caching = false
config.i18n.fallbacks = true
config.active_support.deprecation = :notify
config.log_formatter = ::Logger::Formatter.new
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
config.active_record.dump_schema_after_migration = false
end