【发布时间】:2015-06-02 17:42:00
【问题描述】:
我已经尝试severalguides 让图像和字体出现在 Heroku 上,但似乎没有任何效果。预编译然后推送到 Heroku 和 changing images are referenced 似乎也不起作用。任何帮助将非常感激。 Full source code here.
例如 stylesheets/themes/default/style.css
.iconset {
background-image: image-url("icon/top-tray.png") no-repeat;
background-image: url(image-path('icon/top-tray.png')) no-repeat;
background-image: asset_path('icon/top-tray.png') no-repeat;
background: url(<%= asset_path 'icon/top-tray.png' %>) no-repeat;
}
呈现为
.iconset {
background-image: image-url("icon/top-tray.png") no-repeat;
background-image: url(image-path('icon/top-tray.png')) no-repeat;
background-image: asset_path('icon/top-tray.png') no-repeat;
background: url(<%= asset_path 'icon/top-tray.png' %>) no-repeat;
}
config/environments/production.rb
config.serve_static_assets = false
config.assets.compile = false
config/application.rb
config.assets.paths << Rails.root.join('app', 'assets', 'fonts', 'plugins', 'scss')
config.assets.precompile += %w( .svg .eot .woff .ttf .png .jpg .gif)
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-4 heroku asset-pipeline