Font awesome can be used when you want to put icons such as menu bar, Facebook, instagram, twitter, etc. in a web page.
It is a web font icon that can be used for free.
Site: Font awesome
Add font-awesome-sass to Gemfile and bundle install.
Gemfile
gem 'font-awesome-sass' #After adding and bundle install, restart the server
After bundle install, restart the server, Added font-awesome-sprockets and font-awesome to application.scss file. Note that the icons will not be loaded if the loading order is different.
app/assets/stylesheets/application.scss
@import "font-awesome-sprockets";
@import "font-awesome";
Enter the icon you want in the view (this time, use the fas of class = "fas fa-bars" and the partial bars after fa-). icon is a helper method for font-awesome-sass gem.
rb:app/views/chats/index.html.haml
= icon('fas', 'bars')
You can now put the Font awesome icon on your web page
Reference site Font awesome Github pikawaka font-awesome-sass
Recommended Posts