A
A
Art Snail2017-08-02 09:36:01
Ruby on Rails
Art Snail, 2017-08-02 09:36:01

How to properly include third-party fonts in Rails5?

Third party fonts don't work.
app/assets/config/manifest.js
//= link_tree ../fonts
config/application.rb
config.assets.paths << Rails.root.join("app", "assets", "fonts")
config.assets .precompile << /\.(?:svg|eot|woff|ttf)$/
Fonts are in app/assets/fonts
application.scss
@font-face {
font-family: 'Comfortaa', serif;
src: font-url('Comfortaa/Comfortaa-Regular.ttf') format('truetype');
font-weight: normal
font-style: normal
}
main.scss
.title {
font-family: 'Comfortaa', serif;
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Leonchik, 2017-08-02
@AlexanderMint

Here is an excellent description of the solution for fonts.
In short, we create the assets / fonts
directory And in css we use

font-family: 'simple-line-icons';
src: font-url("Simple-Line-Icons.eot");

Why does it not work for you, you first need to understand "how exactly it does not work"? What's in the css output? Or what's wrong?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question