在我的Rails项目中,我尝试使用自定义字体.有很多与这个问题相关的答案,就像这个没有帮助的答案,我编辑development.rb:
# Add the fonts path
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')
# Precompile additional assets
config.assets.precompile += %w( .svg .eot .woff .ttf )
Run Code Online (Sandbox Code Playgroud)
它仍然显示 No route matches [GET] "/assets/chalkduster-webfont.woff"
我设置我url:
@font-face {
font-family: 'chalkdusterregular';
src: url('chalkduster-webfont.eot');
src:url('chalkduster-webfont.svg#chalkdusterregular') format('svg'),
url('chalkduster-webfont.eot?#iefix') format('embedded-opentype'),
url('chalkduster-webfont.woff') format('woff'),
url('chalkduster-webfont.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)
我font_path('')在源代码中尝试过,font-url()但它也无法运行.:(