Git Product home page Git Product logo

font-awesome-grunticon-rails's Introduction

Rails::Font::Awesome::Grunticon

This is a hand-rolled gem to convert Font Awesome font icons into CSS stylesheets that employ SVG, or failing that, PNG, to display Font Awesome across a wide range of browsers without the need for webfont support.

Installation

Add this line to your application's Gemfile:

gem 'font-awesome-grunticon-rails'

And then execute:

$ bundle

Or install it yourself as:

$ gem install font-awesome-grunticon-rails

Usage

First, you will need to load the generic stylesheet that defines Font Awesome classes:

@import 'font-awesome-grunticon-rails/fa-generic.css';

Then, in your templating language of choice (HAML is shown here), create an <i> object with the fa class as well as the class of the icon you want:

  %li
    = link_to new_site_path do
      %i.fa.fa-plus
      Add Site

If you would like to use SVG effects, make sure to add the data-grunticon-embed attribute (with any value):

  %li
    = link_to new_site_path do
      %i.fa.fa-plus-inactive{'data-grunticon-embed' => 'toggle_me'}
      Add Site

You must then import the provided loader code (font-awesome-grunticon-rails/loader.js) and invoke its loader in your JS:

//= require font-awesome-grunticon-rails/loader

grunticon([
  "/assets/font-awesome-grunticon-rails/icons.data.svg.css",
  "/assets/font-awesome-grunticon-rails/icons.data.png.css",
  "/assets/font-awesome-grunticon-rails/fallback.css",
  grunticon.svgLoadedCallback
);

Development

To rebuild the font-awesome-grunticon-rails stylesheets and Javascript, do the following:

  • Fork this repo
  • npm install
  • Edit icons.list to contain the list of icons you would like to use
  • Change the Gruntfile.js to set whichever colors you would like to compile
  • grunt
  • Add the modified stylesheets and JS to your branch
  • Add your forked font-awesome-grunticon-rails gem (GitHub URL + SHA ref) to your project's Gemfile like this:
  gem 'font-awesome-grunticon-rails', git: 'git://github.com/yourname/font-awesome-grunticon-rails', ref: 'YOUR_SHA_HERE'

Contributing

  1. Fork it ( https://github.com/gsa/font-awesome-grunticon-rails/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

font-awesome-grunticon-rails's People

Contributors

dawnpm avatar loren avatar nickmarden avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.