【发布时间】:2014-09-13 22:48:32
【问题描述】:
我正在尝试在我的 Rails 应用程序中使用 Bootstrap Glyphicons。我尝试按照以下页面上的说明进行操作:
https://gist.github.com/iamatypeofwalrus/6467148
但是当我运行我的应用程序时,图标没有出现,并且我在控制台中收到以下错误:
Failed to load resource: the server responded with a status of 404 (Not Found) http://0.0.0.0:3000/fonts/glyphicons-halflings-regular.woff
Failed to load resource: the server responded with a status of 404 (Not Found) http://0.0.0.0:3000/fonts/glyphicons-halflings-regular.ttf
Failed to load resource: the server responded with a status of 404 (Not Found) http://0.0.0.0:3000/assets/fonts/glyphicons-halflings-regular.woff
Failed to load resource: the server responded with a status of 404 (Not Found) http://0.0.0.0:3000/assets/fonts/glyphicons-halflings-regular.ttf
有什么想法可能是错的吗?
我的 glyphicon 文件都在 vendor > assets > fonts
我的 bootstrap-glyphicons.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('/assets/glyphicons-halflings-regular.woff') format('woff'),url('/assets/glyphicons-halflings-regular.ttf') format('truetype'),url('/assets/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg');}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:normal;line-height:1;-webkit-font-smoothing:antialiased;}
【问题讨论】:
-
如何在 Rails 应用程序上安装 Bootstrap?如果 Rails 版本是 4.0 或更高版本,则应使用
bootstrap-sassgem 及其文档。 -
我使用的是 Rails 3.2。我按照以下说明在没有 gem 的情况下手动安装了 Bootstrap:stackoverflow.com/a/18371521/1720985
标签: ruby-on-rails twitter-bootstrap asset-pipeline glyphicons