Last Updated: February 25, 2016
·
8.109K
· alanho

Clean way to use Bootstrap's Icon glyphs in Rails

I used to do this a lot:

<%= link_to '#', :class => "btn btn-danger" do %>
  <i class="icon-remove"></i>
<% end %>

but if you're using the twitter-bootstrap-rails gem on master branch, you can do it in a cleaner way

<%= link_to glyph(:remove), '#', :class => "btn btn-danger" %>

1 Response
Add your response

Very helpful. Can you clarify what you mean by "on master branch"?

over 1 year ago ·