无法找到类型为'text / css'的文件'css / font-awesome'

时间:2017-08-10 22:17:48

标签: css ruby-on-rails fonts

我已将font-awesome下载到: /app/assets/fonts/font-awesome-4.7.0

当我打开I页面时,我收到:

couldn't find file 'css/font-awesome' with type 'text/css'
Checked in these paths: 
  /home/dercni/Documents/oink201705/app/assets/config
  /home/dercni/Documents/oink201705/app/assets/fonts
  /home/dercni/Documents/oink201705/app/assets/images
  /home/dercni/Documents/oink201705/app/assets/javascripts
  /home/dercni/Documents/oink201705/app/assets/stylesheets
  /home/dercni/.rvm/gems/ruby-2.4.1/gems/cocoon-1.2.10/app/assets/javascripts
  /home/dercni/.rvm/gems/ruby-2.4.1/gems/jquery-rails-4.3.1/vendor/assets/javascripts
  /home/dercni/.rvm/gems/ruby-2.4.1/gems/jquery-turbolinks-2.1.0/vendor/assets/javascripts
  /home/dercni/.rvm/gems/ruby-2.4.1/gems/coffee-rails-4.2.2/lib/assets/javascripts
  /home/dercni/.rvm/gems/ruby-2.4.1/gems/actioncable-5.1.1/lib/assets/compiled
  /home/dercni/.rvm/gems/ruby-2.4.1/gems/actionview-5.1.1/lib/assets/compiled
  /home/dercni/Documents/oink201705/node_modules
  /home/dercni/Documents/oink201705/app/assets/fonts
  /home/dercni/.rvm/gems/ruby-2.4.1/gems/bootstrap-sass-3.3.7/assets/stylesheets
  /home/dercni/.rvm/gems/ruby-2.4.1/gems/bootstrap-sass-3.3.7/assets/javascripts
  /home/dercni/.rvm/gems/ruby-2.4.1/gems/bootstrap-sass-3.3.7/assets/fonts
  /home/dercni/.rvm/gems/ruby-2.4.1/gems/bootstrap-sass-3.3.7/assets/images

在下面:

Extracted source (around line #15):
 *= require_tree .
 *= require_self
 *= require css/font-awesome
 *= require css/govicons
 */
#activity_outer.in,

当我将这些单独的字体文件夹向上移动一级时,它们的工作位置为: /app/assets/font-awesome-4.7.0

我会更有条理地将所有字体存储在字体文件夹中而不是直接存储在资源下但是我看不到在哪里配置它。

1 个答案:

答案 0 :(得分:0)

根据您的错误消息,Rails正在查找 /home/dercni/Documents/oink201705/app/assets/fonts

但它没有找到css/font-awesome

如果css/font-awesome仍在封闭的font-awesome-4.7.0目录中,请尝试编写require语句以在路径中包含该目录名:

*= require font-awesome-4.7.0/css/font-awesome