How to use fonts in Rails 4

前端 未结 9 1553
别那么骄傲
别那么骄傲 2020-12-08 02:03

I have a Rails 4 application and I am trying to use a custom font.

I have followed many tutorials on this and somehow it\'s just not working for my application.

<
9条回答
  •  既然无缘
    2020-12-08 02:28

    In case if you guys have problem using fonts in Rails 5 you just need to edit app/assets/config/manifest.js

    And then insert this //= link_tree ../fonts

    How to use:

    @font-face { font-family: 'FontAwesome'; src: url('fontawesome-webfont.eot?v=4.6.3'); src: url('fontawesome-webfont.eot?#iefix&v=4.6.3') format('embedded-opentype'), url('fontawesome-webfont.woff2?v=4.6.3') format('woff2'), url('fontawesome-webfont.woff?v=4.6.3') format('woff'), url('fontawesome-webfont.ttf?v=4.6.3') format('truetype'), url('fontawesome-webfont.svg?v=4.6.3#fontawesomeregular') format('svg'); font-weight: normal; font-style: normal; }

    And also dont forget to restart your server.

提交回复
热议问题