emptycrate

Octicons!

This is the Bower package for GitHub Octicons.

Add Octicons to your project

  1. Create a new file called bower.json (if you don’t have one already).

  2. Add a new line for the Octicon dependency, pointing to the correct repository:

  {
    "name": "my_great_project",
    "dependencies": {
      "octicons": "*"
    }
  }
  1. Run bower install. The Octicons styles will be downloaded to bower_components/octicons.

  2. Link to the octicons.css stylesheet in the <head> of your <html> page:

  <link rel="stylesheet" href="bower_components/octicons/octicons/octicons.css">
  1. Simply use an icon in your HTML page:
  <span class="octicon octicon-microscope"></span>

Rails’ asset pipeline

Octicons includes a stylesheet specifically for Rails 4/Sprockets.

  1. Create a new file called vendor/assets/bower.json (if you don’t have one already).

  2. Add a new line for the Octicon dependency, pointing to the correct repository:

  {
    "name": "my_great_project",
    "dependencies": {
      "octicons": "*"
    }
  }
  1. cd into vendor/assets and run bower install. The Octicons styles will be downloaded to vendor/assets/bower_components/octicons.

  2. Open your config/application.rb, and add this line inside your Application:

  config.assets.precompile += %w(*.svg *.eot *.woff *.ttf)
  1. In your application stylesheet, require sprockets-octicons:
  /*
  = require sprockets-octicons
  */
  1. Simply use an icon in your HTML page:
  <span class="octicon octicon-flame"></span>
  1. If you want a view helper, add something like this to app/helpers/application_helper.rb:
  def octicon(code)
    content_tag :span, '', :class => "octicon octicon-#{code.to_s.dasherize}"
  end

Installing locally

It’s easy to install octicons locally if you have Homebrew installed. Simply run the following commands:

brew install caskroom/cask/brew-cask
brew tap "caskroom/fonts"
brew cask install "font-octicons"

Best practices

Resources

Why can’t I see the characters in Font Book??

Give this a try, you should be all set:

FAQ

Check out issues with the FAQ label.

Versions

Octicons operates similarly to Semver with the following version convention: