相关疑难解决方法(0)

使用@ font-face和Rails 3.1应用程序?

我使用以下@font-face声明无法使用我的Rails 3.1应用程序.我把资产管道的字体在其所谓的"字体"自己的文件夹一起imagesstylesheetsjavascripts

这是我使用的声明(由Font Squirrel生成.)

@font-face {
  font-family: 'ChunkFiveRegular';
  src: url('Chunkfive-webfont.eot');
  src: url('Chunkfive-webfont.eot?#iefix') format('embedded-opentype'),
     url('Chunkfive-webfont.woff') format('woff'),
     url('Chunkfive-webfont.ttf') format('truetype'),
     url('Chunkfive-webfont.svg#ChunkFiveRegular') format('svg');
  font-weight: normal;
  font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)

有人在他们的Rails 3.1应用程序上成功使用@ font-face吗?

更新

我刚刚阅读了这个主题http://spin.atomicobject.com/2011/09/26/serving-fonts-in-rails-3-1/,它说urlfont-url在声明中改变.不幸的是,这似乎没有用.

css sass css3 font-face ruby-on-rails-3.1

32
推荐指数
4
解决办法
2万
查看次数

字体glyphicons不使用bootstrap 3和rails 4

我无法让glyphicons与bootstrap 3和rails一起使用.我已经在互联网上找到了灵感,没有找到任何帮助.在我的bootstrap.css文件中,我有:

@font-face {
  font-family: 'Glyphicons Halflings';

  src: url('/assets/glyphicons-halflings-regular.eot');
  src: url('/assets/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
}
Run Code Online (Sandbox Code Playgroud)

在application.rb中,我有:

config.assets.enabled = true  
config.assets.paths << "#{Rails.root}/app/assets/fonts" 
config.assets.precompile += %w( .svg .eot .woff .ttf )
Run Code Online (Sandbox Code Playgroud)

我已经尝试过跑:

rake资产:预编译RAILS_ENV =开发

在application.js我有:

//= require jquery
//= require jquery_ujs
//= require_tree .
//= require bootstrap
Run Code Online (Sandbox Code Playgroud)

在application.css我有:

 *= require_self
 *= require_tree .
 *= require bootstrap
 */
Run Code Online (Sandbox Code Playgroud)

我的所有字体都存储在资源/字体中

我已经看过以下内容,但没有一个有效:

Bootstrap 3 + Rails 4 - 某些Glyphicons不工作

如何将自定义字体添加到Rails应用程序?

我怎样才能解决这个问题?

ruby-on-rails asset-pipeline twitter-bootstrap twitter-bootstrap-rails ruby-on-rails-4

1
推荐指数
1
解决办法
5226
查看次数