在开发环境中完美运行,但在生产环境中无法正常工作。它找不到以下文件:
/assets/fontello.woff
/assets/fontello.ttf
设置如下:
- 字体文件:
assets.rb
Rails.application.config.assets.paths << Rails.root.join('app', 'vendor', 'assets', 'fonts') Rails.application.config.assets.precompile << /\.(?:svg|eot|woff|ttf)\z/
fontello.css
@font-face { font-family: 'fontello'; src: url('/assets/fontello.eot'); src: url('/assets/fontello.eot#iefix') format('embedded-opentype'), url('/assets/fontello.woff') format('woff'), url('/assets/fontello.ttf') format('truetype'), url('/assets/fontello.svg#fontello') format('svg'); font-weight: normal; font-style: normal; }
就像我之前说的,开发环境下一切都工作得很好。我尝试了很多事情,例如:
- moving the fonts in the public folder (as my images there are loaded)
add the following line in the
assets.rb
:Rails.application.config.assets.precompile += [/^[-_a-zA-Z0-9]*\..*/]
但是什么都没用。
你能建议其他尝试的方法吗?