Rails with bootstrap installed via yarn can't find fonts

Viewed 766

I have a Rails 5 app with Bootstrap which I installed with yarn. I did the following:

yarn add bootstrap

bootstrap@^3.3.7:
  version "3.3.7"
  resolved "https://registry.yarnpkg.com/bootstrap/-/bootstrap-3.3.7.tgz#5a389394549f23330875a3b150656574f8a9eb71"

on application.css

 *= require bootstrap/dist/css/bootstrap

on application.js

//= require bootstrap/dist/js/bootstrap
//= require rails-ujs
//= require @fnando/sparkline/dist/sparkline
//= require_tree .

on assets.rb

Rails.application.config.assets.paths << Rails.root.join('node_modules')
Rails.application.config.assets.paths << Rails.root.join('node_modules/bootstrap/dist/fonts')
Rails.application.config.assets.precompile << %r{node_modules/bootstrap/dist/fonts/[\w-]+\.(?:eot|svg|ttf|woff2?)$}

Still, when I access it on production (Heroku) I get

ActionController::RoutingError (No route matches [GET] "/fonts/glyphicons-halflings-regular.ttf"):

I tried add $icon-font-path: "node_modules/bootstrap/dist/fonts"; as well to my scss but that also didn't worked

1 Answers
Related