0

i'm using Montserrat font in my ruby on rails application. In my desktop the font appear, but I checked on other pc and it's on times new roman.

I added this in application.rb:

config.assets.paths << Rails.root.join("app", "assets", "fonts")
config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/

and my fonts are in assets/fonts/montserrat:

enter image description here

and this is my font.scss

@font-face {
  font-family: 'Montserrat';
  font-weight: normal;
  font-style: normal;
  src: font-url('montserrat/montserrat-regular-webfont.eot');
  src: font-url('montserrat/montserrat-regular-webfont.eot?#iefix') format('embedded-opentype'),
  font-url('montserrat/montserrat-regular-webfont.woff') format('woff'),
  font-url('montserrat/montserrat-regular-webfont.ttf') format('truetype'),
  font-url('montserrat/montserrat-regular-webfont.svg') format('svg');
}

and I call the font like this:

.welcome{
  font-family: 'Montserrat';
  color: #333;
  text-align: center;
}

what am I doing wrong?

terrorista
  • 227
  • 1
  • 15
  • sidenote: if you're using WOFF, you don't need ttf/otf; SVG fonts have been abandoned because they were terrible, and `eot` is depracated in favour of WOFF, so you don't need all these different formats (it's thankfully no longer 2012), just use WOFF and reduce complexity. For more information, see http://stackoverflow.com/a/37091681/740553 – Mike 'Pomax' Kamermans May 30 '16 at 20:11
  • i just need the woff url ? – terrorista May 30 '16 at 20:59
  • at least in terms of supporting the current web, you only need the WOFF resource, and none of the other ones. And then in your `scss` you only need the woff's url. – Mike 'Pomax' Kamermans May 30 '16 at 21:12
  • i removed but its not working – terrorista May 30 '16 at 22:02
  • I know, I wasn't trying to solve your problem, just explaining how, today, you don't need all those font formats, just you just need a single format. – Mike 'Pomax' Kamermans May 30 '16 at 23:07

1 Answers1

0

You must run bundle exec rake assets:precompile RAILS_ENV=production then do a git add/git commit then push the new commit to your production.

fqxp
  • 7,680
  • 3
  • 24
  • 41
bkunzi01
  • 4,504
  • 1
  • 18
  • 25