我无法在Rails 4中使用资源管道来处理字体。
我已经lato-black.eot
了:
assets/fonts/lato/lato-black.eot
我在flat-ui.css
(不是scss)
@font-face {
font-family: 'Lato';
src: font-path('lato/lato-black.eot');
src: font-path('lato/lato-black.eot?#iefix') format('embedded-opentype'), font-path('lato/lato-black.woff') format('woff'), font-path('lato/lato-black.ttf') format('truetype'), font-path('lato/lato-black.svg#latoblack') format('svg');
font-weight: 900;
font-style: normal;
}
我在config/application.rb
# config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
编辑:这不适用于css代码:
@font-face {
font-family: 'Lato';
src: url(<%= asset_path 'lato/lato-black.eot' %>);
src: url(<%= asset_path 'lato/lato-black.eot?#iefix' %>) format('embedded-opentype'), url(<%= asset_path 'lato/lato-black.woff' %>) format('woff'), url(<%= asset_path 'lato/lato-black.ttf' %>) format('truetype'), url(<%= asset_path 'lato/lato-black.svg#latoblack' %>) format('svg');
font-weight: 900;
font-style: normal;
}
答案 0 :(得分:0)
尝试使用asset-url()而不是font-path()
src: asset-url('lato/lato-black.eot');
在你的produ.rb:
# Precompile additional assets
config.assets.precompile += %w( .svg .eot .woff .ttf )