0.06
No release in over 3 years
Low commit activity in last 3 years
Gem allows to use `flag-icon-css` - a collection of all country flags in SVG - in your Rails projects
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 5.10.0
>= 0
>= 3.2, < 6
~> 0.50.0
~> 0.9.5

Runtime

 Project Readme

flag-icons-rails

Gem Version Gem Downloads Gem Total Downloads
Build Status Code Climate Codacy Badge

flag-icons-rails provides flag-icon-css - a collection of all country flags in SVG - as a Ruby gem for use with the asset pipeline.

Installation

Add this to your Gemfile:

gem 'flag-icons-rails'

and then execute:

bundle install

Do not add gem to assets section if you want to use flag_icon rails helper.

Usage

In your application.css, include the file:

/*
 *= require flag-icon
 */

If you prefer SCSS, add this to your application.scss file:

@import "flag-icon";

Then restart your webserver if it was previously running.

Plain usage

In your view:

<span class="flag-icon flag-icon-by"></span>
<span class="flag-icon flag-icon-by flag-icon-squared"></span>

Rails Helper usage

In your view:

flag_icon(:by)
# => <span class="flag-icon flag-icon-by"></span>
flag_icon(:by, element: :div)
# => <div class="flag-icon flag-icon-by"></div>
flag_icon(:by, squared: true)
# => <span class="flag-icon flag-icon-by flag-icon-squared"></span>
flag_icon(:by, id: 'my-flag', class: 'strong')
# => <span id="my-flag" class="flag-icon flag-icon-by strong"></span>

Thanks