All threads / Rails 7 custom fonts are not working on staging enviroment
Ask A Question


You’re not receiving notifications from this thread.

Rails 7 custom fonts are not working on staging enviroment

Siva asked in CSS

In development mode the custom fonts (Raleway) are present but it is not reflected in the staging environment. I deployed my app to Heroku.

Added the following command in the application.rb

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

Added the font-family in the application.bootstrap.scss

@font-face {
  font-family: 'raleway-regular';
  font-style: normal;
  font-weight: 400;
  src: font-url('raleway-regular.ttf') format('truetype');

@font-face {
  font-family: 'raleway-semibold';
  src: font-url('raleway-semibold.ttf') format('truetype');

@font-face {
  font-family: 'raleway-medium';
  src: font-url('raleway-Medium.ttf') format('truetype');

The font files are available in the my_app/app/assets/fonts directory.

I created my rails using the command rails new my_app --javascript esbuild --css bootstrap --database postgresql

Rails version 7

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 61,257+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.