font-awesome-sass
font-awesome-sass copied to clipboard
Helper#icon prepends fa- to given fa class string
I made the improvement on the helper method. Now it can handle multiple fa-
classes.
For example, to add fa-2x
class we need to use icon('flag', class='fa-2x')
which make more sense to use it as the following.
icon('flag 2x')
# => <i class="fa fa-flag fa-2x"></i>
You should probably call to_s
on icon
before trying to split
it. Before this change, a Symbol
could be passed in, but now it requires a String
, potentially causing existing usages to break.
How about optional array instead?
icon([:flag, '2x', :fw], "Big Flag")
# => <i class="fa fa-flag fa-2x fa-fw"></i>
icon(:flag, 'Normal flag')
# => <i class="fa fa-flag"></i>
@nickpearson and @andreykul good points guys. I have made it to support more formats.
icon(:flag)
# => <i class="fa fa-flag">
icon('flag')
# => <i class="fa fa-flag">
icon([:flag, :fw, '2x'])
# => <i class="fa fa-flag fa-fw fa-2x">
icon("flag fw 2x")
# => <i class="fa fa-flag fa-fw fa-2x">