我正在尝试在我的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你知道可能出了什么问题吗?
我的字形图标文件都在供应商>资产>字体中
我的bootstrap-glphicons.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;}发布于 2014-09-14 11:29:02
我认为您没有正确完成该要点中的步骤4。您需要更新CSS文件中的字体URL,以便它引用正确的位置。
示例:
src:url('../fonts/glyphicons-halflings-regular.eot');变成了
src:url('/assets/glyphicons-halflings-regular.eot');根据您的错误消息,我可以看到它仍然引用了错误的位置,即/assets/fonts (正确的路径不应该在URL中包含fonts )。
致以敬意,
https://stackoverflow.com/questions/25828484
复制相似问题