Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku not loading Google fonts

I'm running a site on Heroku, and having some troubles getting a google font to load.

My typography.sass file contains this:

@import url(http://fonts.googleapis.com/css?family=Bitter)

h1
  font-family: 'Bitter', Helvetica, serif

My production.rb file contains the lines:

config.serve_static_assets = true
config.assets.compile = true
config.assets.digest = true

My Gemfile includes:

gem 'rails_12factor', group: :production

I've gone through all the Heroku issues with the asset pipeline, and I've gotten all of my images and css files to load properly in production, but for whatever reason, the font only works in development.

like image 642
oolong Avatar asked Jul 16 '13 16:07

oolong


2 Answers

I had the same problem and found this answer:

https://stackoverflow.com/a/18216759

It appears that Heroku wants https. So throwing in https solved the problem for me.

like image 122
ellerynz Avatar answered Nov 09 '22 17:11

ellerynz


I used to have the same issue but deleting the assets folder located in the public folder solved the problem for me. This will let Heroku precompile the css files for you and not use the files generate by running rake assets:precompile locally.

like image 4
Ayman Avatar answered Nov 09 '22 17:11

Ayman