-
Notifications
You must be signed in to change notification settings - Fork 75
Added Font Awesome helper. #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@buren Wow, thanks for the PR! Personally, I don't know about Font Awesome. Is it part of Bootstrap? I looked for it in getbootstrap.com and I couldn't find anything… I thought Bootstrap only supported Glyphicons by default. |
|
@claudiofullscreen you're right, there seems to be no documentation of Font Awesome at http://getbootstrap.com, however they do reference Font Awesome at their CDN: http://www.bootstrapcdn.com/#fontawesome_tab I could add |
|
found a reference to it under the getboostrap.com domain name: http://glyphicons.getbootstrap.com/#tab_quickstart seems like they officially support it. |
|
Mmmh… now I see, I just looked http://fortawesome.github.io/Font-Awesome/examples up and I understand. The only difference with glyphicons is that you have to include a separate CSS file for "font awesome" icons to show up, the rest is very similar. Let me spend some more time on this, I want to make sure that the two stylesheets do not clash 😆 Apart from that, having the CDN helper would be definitely beneficial, as well as probably coming up with a better helper name. For instance <%= glyphicon :heart %>is very legible, but <%= font_awesome :heart %>is a little "harsher". Here's an idea… what if there was a new helper called Just an idea… what do you think? Also, what names would you pick for the parameters? |
|
I have another branch where I instead named the method Another option would be to have it as a config option to use And I like your idea of being able to specify |
|
Mmmh… I'm not 100% sure about the config option. If Bh supported both, wouldn't it be nice to be able to mix-and-match them? For instance: <%= icon :heart, library: :glyphicons %>
<%= icon :heart, library: :font_awesome %>would result in <span class="glyphicon glyphicon-heart"></span>
<span class="fa fa-heart"></span>Then the method would be modular enough to add more libraries in the future (like another one I just discovered while looking for Font Awesome: elusive). On a side note, I saw that you used
|
|
One more note… about the name… could be I'm leaning more towards |
|
I agree with Will update this pull-request first with full support for all font-awesomes options and then look at moving to |
|
Do you think the |
7fccb0e to
9494617
Compare
|
Yes, :glyphicons should be the default library, since 200 of its icons come by default in the Bootstrap CSS. Of course these are just HTML helpers, so it's up to you to load at the top of the page the corresponding CSS files. In other words, if I use Bh without loading any CSS, I can still write <%= icon :heart %>and obtain the following in my HTML: <span class="glyphicon glyphicon-heart"></span>but without the appropriate CSS, I wouldn't see anything (an empty span!). The same thing would happen if someone type But the nice thing is that anyone with the full glyphicon library (not just the 200 icons that come with Bootstrap) would be able to keep the same syntax and write (for instance) My thought for now is to use I imagine there would be a method to identify what prefix to use based on the library, something on the line of: case options[:library].to_s
when 'font-awesome' then :fa
else options[:library]
end |
|
How should we support both libraries in |
|
I don't think we need; in that case it would just use the glyphicon, since glyphicon is included by default, and that's what the bootstrap example uses: http://getbootstrap.com/css/#forms-control-validation |
|
But it would be a problem if you don't load glyphicons at all See #14 for |
|
@buren Is there a way to load Bootstrap and not load the 200 glyphicons that come with it? If there is, I have missed it! |
|
Closing this in favor of #14 |
No description provided.