Skip to content
This repository has been archived by the owner on Nov 28, 2017. It is now read-only.

Commit

Permalink
Merge pull request #11 from primer/updating_octicons_5
Browse files Browse the repository at this point in the history
Major updates for 3.0.0
  • Loading branch information
jonrohan authored Oct 29, 2016
2 parents e1b165f + 1680c55 commit 29566b2
Show file tree
Hide file tree
Showing 185 changed files with 56 additions and 1,588 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# HEAD

# 3.0.0

- Added: `to_svg_use` which will output a `<svg><use>` tag for svg spritesheets
- Added: Ability to output the spritesheet with `Octicons.sprite_sheet`
- Updating to new version of [octicons@5.0.0](https://github.com/primer/octicons/blob/master/CHANGELOG.md#500)
- Removed: api endpoints for `decimal`, `hexadecimal`, and `character`
- Removed: svg directory from `/lib/` this isn't necessary anymore with the updated `data.json` from 5.0.0
- Removed: `Octicons::KEYWORDS` and `Octicons::CODEPOINTS`, Codepoints is deprecated and Keywords can be accessed via `Octicons::OCTICON_SYMBOLS`

# 2.1.0

- Updating to new version of [octicons@4.3.0](https://github.com/primer/octicons/blob/master/CHANGELOG.md#430)
Expand Down
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ source 'https://rubygems.org'

gemspec

gem 'nokogiri'

group :development, :test do
gem 'rake'
gem 'minitest'
Expand Down
43 changes: 16 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,6 @@ Width is the icon's true width. Based on the svg view box width. _Note, this doe

Height is the icon's true height. Based on the svg view box height. _Note, this doesn't change if you scale it up with size options, it only is the natural height of the icon_

#### Methods

##### `to_svg`

Returns a string of the svg tag

```rb
icon = Octicons::Octicon.new("x")
icon.to_svg
# <svg class="octicon octicon-x" viewBox="0 0 16 16" width="16" height="16" version="1.1" "aria-hidden"="true"><path d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path></svg>
```

##### `keywords`

Returns an array of keywords for the icon. The data [comes from the octicons repository](https://github.com/primer/octicons/blob/master/lib/keywords.json). Consider contributing more aliases for the icons.
Expand All @@ -103,34 +91,35 @@ icon.keywords
# ["remove", "close", "delete"]
```

##### `decimal`
#### Methods

Returns an `Integer` representing the codepoint of the character within the font file.
##### `to_svg`

Returns a string of the svg tag

```rb
icon = Octicons::Octicon.new("alert")
icon.decimal
# 61485
icon = Octicons::Octicon.new("x")
icon.to_svg
# <svg class="octicon octicon-x" viewBox="0 0 16 16" width="16" height="16" version="1.1" "aria-hidden"="true"><path d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48z"></path></svg>
```

##### `hexadecimal`
##### `to_svg_use`

Returns an `String` representing the hexadecimal codepoint of the character within the font file.
Returns a string of the svg tag

```rb
icon = Octicons::Octicon.new("alert")
icon.hexadecimal
# "f02d"
icon = Octicons::Octicon.new("x")
icon.to_svg_use
# <svg class="octicon octicon-x" viewBox="0 0 16 16" width="16" height="16" version="1.1" "aria-hidden"="true"><use xlink:href="#x" /></svg>
```

##### `character`
##### `sprite_sheet`

Returns the unicode character of the icon. When placing this with the octicons font turned on, you'll see the icon.
The Octicons class has a method that will output the svg sprite sheet that you can inline in your app.

```rb
icon = Octicons::Octicon.new("alert")
icon.character
# ""
Octicons.sprite_sheet
# <svg xmlns="http://www.w3.org/2000/svg"><symbol viewBox="0 0 16 16" id="alert">...</svg>
```

## Publishing
Expand Down
174 changes: 0 additions & 174 deletions lib/codepoints.json

This file was deleted.

1 change: 1 addition & 0 deletions lib/data.json

Large diffs are not rendered by default.

Loading

0 comments on commit 29566b2

Please sign in to comment.