我的导轨应用程序在开发模式下工作,看起来完全按照我的要求,但在生产中它看起来不同铬和safari,在safari徽标图像加载但不是字体,在铬的字体加载,但没有图像加输入字段是一点点时间和铬对齐错误对齐,但在开发模式,这一切都看起来不错在铬导轨资产没有预编译,css在生产中看起来不同
我一直在搞这一段时间,并删除公众/资产几次做
rake assets:precompile RAILS_ENV=production
没有成功,预编译经过,没有任何错误
的config/application.rb中:
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
config.assets.paths << "#{Rails.root}/assets/fonts"
config.assets.paths << "#{Rails.root}/assets/images"
config.assets.paths << Rails.root.join("app", "assets", "fonts")
config.assets.precompile += %w(.svg .eot .woff .ttf)
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.assets.enabled = true
#config.assets.paths << "#{Rails.root}/app/assets/fonts"
配置/环境/制作:
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both thread web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = true
#config.assets.compile = true
config.assets.precompile = ['*.js', '*.css', '*.css.erb', '*.css.scss']
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
config.assets.paths << "#{Rails.root}/assets/fonts"
config.assets.paths << "#{Rails.root}/assets/images"
config.assets.precompile += %w(.svg .eot .woff .ttf)
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
config.assets.precompile << /(^[^_\/]|\/[^_])[^\/]*$/
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
你的生产环境是什么?你正在部署到Heroku吗? – winston
不,我在Puma上运行的Nitrous.IO上使用我自己的盒子 – franklinexpress
你也运行nginx吗?您可能需要设置配置。在生产配置中将serve_static_assets设置为false。你也可以发布你的徽标和CSS链接的代码吗? – winston