I have moved the @import url(http://fonts.googleapis.com/css?family=Lato:300,400,900,300italic,400italic,900italic);
to the top of the application.css file and it works now! :)
Rails Production Server Google Font Not Loading
-
27-09-2022 - |
Question
I have a production server running (digital ocean ruby on rails image [NGINX+UNICORN]), and everything is working except for google fonts. All other fonts that are local are located in the /public/fonts folder and are loaded as http://domain.com/fonts/font.eot. The problem is that the google fonts wont load
@import url(http://fonts.googleapis.com/css?family=Lato:300,400,900,300italic,400italic,900italic);
This makes my application looks really different and makes it sort of ugly. There is a similar question asked here: Heroku and Google Fonts but that solution does not work. I have also tried adding the code instead of import but that also does not work. Finally I checked in the network tab of chrome and that does not work as well.
Solution
OTHER TIPS
For anyone else who comes across this problem, the solution that worked for me was to comment out the line config.assets.css_compressor = false
in config/environments/production.rb
Hope this helps someone!