我有一个Rails应用程序,为了管理我的资产,我使用Bower。如果可能的话,我宁愿不要对诸如JS和CSS之类的资产使用gem。
在我的vender/assets/stylesheets
目录我具备以下条件:font-awesome
在有scss
和fonts
。
在我的轨道上,app/assets/stylesheets/application.scss
我有以下内容:
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the top of the
* compiled file, but it's generally better to create a new file per style scope.
*
*= require_self
*= require_tree .
*= require style.scss
*= require chosen/chosen.min
*= require jquery.ui.all
*= require selectize.js/css/selectize.css
*= require selectize.js/css/selectize.bootstrap3.css
*= require font-awesome/scss/font-awesome
*/
页面加载正常。但是,当我这样做时:<i class="fa-question></i>
我得到的不是问号,而是得到的[]
。因此,我检查了chrome中的“ sources”标签,查看正在加载的内容,并在font-awesome
目录下找到了,然后font-awesome.scss
在其中查看:
/*!
* Font Awesome 4.1.0 by @davegandy - http://fontawesome.io - @fontawesome
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
*/
@import "variables";
@import "mixins";
@import "path";
@import "core";
@import "larger";
@import "fixed-width";
@import "list";
@import "bordered-pulled";
@import "spinning";
@import "rotated-flipped";
@import "stacked";
@import "icons";
因此,我有信心地说这正在加载CSS,但是字体并未加载。因此,我查看了将在其中定义字体路径的变量,然后查看:
$fa-font-path: "../fonts" !default;
基于上面概述的目录结构,fonts目录确实是一个目录。
那么,这是怎么回事?
我遇到了类似的问题,并通过使用以下css文件将其修复:
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
我不记得出了什么问题,只是希望能有所帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句