rails:字体不会出现在制作中

时间:2016-05-30 16:58:11

标签: css ruby-on-rails fonts

我在我的ruby on rails应用程序中使用蒙特塞拉特字体。在我的桌面上出现了字体,但是我在其他电脑上查看了它的新时代。

我在application.rb中添加了这个:

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

我的字体在assets / fonts / montserrat:

enter image description here

这是我的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');
}

我打电话给这样的字体:

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

我做错了什么?

1 个答案:

答案 0 :(得分:0)

你必须运行&#34;捆绑exec rake资产:preocompile RAILS_ENV = production&#34;然后执行git add / git commit,然后将新提交推送到您的生产中。

相关问题