[英]Ruby on rails twitter bootstrap glyphicons path problems
I am using twitter bootstrap with ruby on rails project having added the appropriate gems etc. 我在Twitter项目上使用Twitter Bootstrap并在Ruby项目上添加了适当的宝石等。
Everything was working perfectly until I added a glyph icon - as per : 一切工作正常,直到我添加了字形图标-按照:
<span class="glyphicon glyphicon-user"></span>
Now I get this error: 现在我收到这个错误:
http://localhost:3000/assets/twitter-bootstrap-static/twitter/fonts/glyphicons-halflings-regular.ttf - HTTP 404.
I have read a number of other similar questions about this on stack overflow but the solutions dont seem to fit with my application. 我在堆栈溢出时已经读过许多其他类似的问题,但是解决方案似乎不适合我的应用程序。
Most of the suggested fixes deal with the app/assetts/stylesheets/bootstrap_and_overrides.css.less for those interested this is the current contents of this file : 对于那些有兴趣的人,大多数建议的修复程序都涉及app / assetts / stylesheets / bootstrap_and_overrides.css.less,这是此文件的当前内容:
@import "twitter/bootstrap/bootstrap";
// Set the correct sprite paths
@iconSpritePath: image-url("twitter/bootstrap/glyphicons-halflings.png");
@iconWhiteSpritePath: image-url("twitter/bootstrap/glyphicons-halflings-white.png");
// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
@fontAwesomeEotPath: font-url("fontawesome-webfont.eot");
@fontAwesomeEotPath_iefix: font-url("fontawesome-webfont.eot?#iefix");
@fontAwesomeWoffPath: font-url("fontawesome-webfont.woff");
@fontAwesomeTtfPath: font-url("fontawesome-webfont.ttf");
@fontAwesomeSvgPath: font-url("fontawesome-webfont.svg#fontawesomeregular");
// Font Awesome
@import "fontawesome/font-awesome";
// Glyphicons
//@import "twitter/bootstrap/glyphicons.less";
// Your custom LESS stylesheets goes here
//
// Since bootstrap was imported above you have access to its mixins which
// you may use and inherit here
//
// If you'd like to override bootstrap's own variables, you can do so here as well
// See http://twitter.github.com/bootstrap/customize.html#variables for their names and documentation
//
// Example:
// @link-color: #ff0000;
Perhaps the iconspritepath in this file is wrong? 也许此文件中的iconspritepath错误? I am not sure what it should be though?
我不确定应该是什么?
Please help! 请帮忙!
I found out the problem. 我发现了问题。 It seems by default in ruby on rails it is setup to use fontawesome glyphicons instead of the default glyphicons with bootstrap.
在默认情况下,似乎在Rails中的ruby中已设置为使用fontawesome字形图标,而不是带有引导程序的默认字形图标。
Therefore I just needed to use a different css class for which I used this site : 因此,我只需要使用用于此站点的另一个CSS类:
http://fortawesome.github.io/Font-Awesome/icons/ http://fortawesome.github.io/Font-Awesome/icons/
Fontawesome definitely is better than the default glyphicons so I now used : Fontawesome绝对比默认字形要好,所以我现在使用:
<span class="fa fa-users fa-2x"></span>
for my person icon! 为我的人形图标!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.