Using fonts with Rails asset pipeline

前端 未结 12 1866
慢半拍i
慢半拍i 2020-11-22 14:52

I have some fonts being configured in my Scss file like so:

@font-face {
  font-family: \'Icomoon\';
  src: asset-url(\'icoMoon.eot?#iefix\', font) format(\'         


        
12条回答
  •  被撕碎了的回忆
    2020-11-22 15:14

    You need to use font-url in your @font-face block, not url

    @font-face {
    font-family: 'Inconsolata';
    src:font-url('Inconsolata-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    }
    

    as well as this line in application.rb, as you mentioned (for fonts in app/assets/fonts

    config.assets.paths << Rails.root.join("app", "assets", "fonts")
    

提交回复
热议问题