Recently, I have add bootstrap.min.css
manually, not from gem. And I got error when trying to add Bootstrap glyphicons. I’m not sure using gem does get this error or not. However, This just a trick to add Bootstrap Glyphycons to Rails manully alongside.
The first thing you need to do is add @fontface
in your bootstrap file:
@font-face { font-family: 'Glyphicons Halflings'; src: url('/fonts/glyphicons-halflings-regular.eot'); src: url('/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); }
After that, in order to make these fonts works, I added bootstrap fonts
folder to public
folder
Finally, use it in you view file like this:
<span class="tag-item"><span class="glyphicon glyphicon-tag"></span> <a href="">Tag 1, </a></span>