Adding fonts to asset pipeline

 Gabriel Rodríguez
Gabriel Rodríguez
March 15, 2020
Integration
Ruby
Ruby on Rails
Rails
 Adding fonts to asset pipeline

Well, first of all you have to add a new folder in app/assets called "fonts" with all your custom fonts inside.
After that you have to tell Sprockets to compile that new fonts folder.
You should add this line into your config/application.rb file:

You don’t need to do that after Rails 4.1, that folder is already added by default. You should use it if you are using another folder such as “vendor/assets/fonts”.
Last thing you need to do is reference the fonts in your css.scss using the ‘font-path’ helper.
This is an example:

 

The compiled css is going to be like this:


As you can see, each font reference has this format:

"/assets/fontawesome-webfont-3b53a5ecdb9473016ee097f74f4f16c0.eot"

More font tips?

For the font-family value, don’t use spaces:

Wrong: “Font Awesome”
Right: “FontAwesome”

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Playing with Ruby on Rails + Hotwire creating a simple app

The article guides the creation of a high-performance grocery list app using Ruby on Rails 7 and Hotwire, highlighting Turbo's efficiency in accelerating page changes without extensive JavaScript.

December 19, 2023
Read more ->
Ruby on Rails
Hotwire

Salesforce Integration Options: REST API, SOAP API, and Heroku Connect

In this article we break down the different options for integrating with Salesforce CRM, which are REST API, SOAP API, and Heroku Connect.

December 4, 2019
Read more ->
Integration
API
Salesforce

Get in Touch

Let's Discuss Your IT Augmentation Needs

Have questions or are interested in our IT Staff Augmentation services? We'd love to hear from you. Reach out to our team using the contact information below, and we'll be in touch shortly to discuss how we can support your projects.

Find Us!

One Beacon St, 15th Floor, Boston, MA 02108

What do you need help with?
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
"They're very collaborative, and they offer great benefits to us. The interaction is very important to us, and they take time to explain their process. They excel in all aspects of what we do, and I would recommend them to anybody."
Jonathan Wride
CEO at