当我开始生产时,许多资产都丢失了。没有背景图像,但有来自 css 的背景样式。许多JS不加载..
我输入了配置 production.rb :
config.cache_classes = true
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
config.assets.compress = true
config.assets.compile = false
config.assets.digest = true
在 application.rb :
config.assets.precompile += %w( ie.css )
config.assets.paths << "#{Rails.root}/app/assets/fonts"
但字体不加载。我在公共/资产中看到所有字体,但我的网站上没有。
有人可以写答案 - 如何配置应用程序在生产中工作?为什么我从 css 文件中有 xxx.jpg 但没有从同一个 css 文件中获得 yyy.jpg ..
背景的CSS:
body{
line-height: 1;
background: #fff url('wallpaper.jpg') top left;
图像位置 - 资产/图像
字体位置 - 资产/字体
有时在 chrome 控制台中我看到:
GET ..../assets/wallpaper.jpg 404 (Not Found) xxxxxx/:11
GET...../assets/main_page.png 404 (Not Found) xxxxxx/:30
GET ...../assets/fonts/Lato-Bol.ttf 404 (Not Found)
有时没有,但总是没有字体和许多资产。
我的应用程序CSS:
*= require_self
*= require chosen
*= require fancybox
*= require page
*= require_tree .
*/