faw_icon 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c685c990088f34003403197d138cf3367dcc64f83445902093f1db993bcc664a
4
- data.tar.gz: ef87805daa53c20ecbd399890124420ea987e44f815c51ea867bcd877d17f40c
3
+ metadata.gz: c9eae78c0e05454bbc1f99c152a9af2d9a2cb383044ab244f1b6c063bd5cbc27
4
+ data.tar.gz: 9327927c37f74b8d46d9a63495f6811241cf1efb55d22914fef8d0d27847400a
5
5
  SHA512:
6
- metadata.gz: 25ff92e635f0723d61e8bf43322d2258c603e7212ea3dab96fc13ce30f537897fbcd17fa680b3833938b37a657104d83754d49cd9a73c60052001c349883cd63
7
- data.tar.gz: bb123d73d28fed2c6f04e0afff80f478004294bdc4d1c01f796ef4355a0e76e2603a5e46c1ea5e62aed97dc4ada0f7b7dfc9d7d02946acbf045bcacde1e1c6c3
6
+ metadata.gz: f1fa4dd691872a144ad02d79c73c4039ec59cc19b4d37e8c85c116a73952fb900d17ac5fc81b446e53a3748d42dd2ca0628972a954e86e8bfbd23b7cd63ed472
7
+ data.tar.gz: 3b6f601ebc444a65189315a64626220f51fd3d76d318811b7d19d672eb76a409e363a5ae17cbba5e869a0d5d632dd9da885c1538429e26f9d5d773acf8db8e42
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- faw_icon (0.1.0)
4
+ faw_icon (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -6,8 +6,7 @@ By design only the svg-with-js version is supported following the recommendation
6
6
  https://fontawesome.com/get-started/svg-with-js.
7
7
 
8
8
  Another great feature is that is does not bundle any icons making it super fast to download and install
9
- as well as providing the ability to use new icons as they become available or opting for the
10
- PRO collection.
9
+ as well as providing the ability to use new icons as they become available custom ones or the PRO collection.
11
10
 
12
11
  ## Installation
13
12
 
@@ -57,13 +56,13 @@ Then just use them like this
57
56
  <%= faw_icon 'regular', 'sync', {spin: true} %>
58
57
  <%= faw_icon 'brand', 'android', {transform: 'grow-5'} %>
59
58
 
60
- Bear in mind that the `brand` icons only come in one style called `brand` (!)
59
+ Bear in mind that the `brand` icons only come in one style called `brand`(!)
61
60
  and the rest come in three variations but not all are available in the free collection.
62
61
  Find them all in the [gallery](https://fontawesome.com/icons?d=gallery)
63
62
 
64
63
  ## Contributing
65
64
 
66
- Bug reports and pull requests are welcome on GitHub at https://github.com/alexwebgr/faw_icon. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
65
+ [Issues](https://github.com/alexwebgr/faw_icon/issues) and [pull requests](https://github.com/alexwebgr/faw_icon/pulls) are more than welcome. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
67
66
 
68
67
  ## License
69
68
 
@@ -71,4 +70,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
71
70
 
72
71
  ## Code of Conduct
73
72
 
74
- Everyone interacting in the FawIcon project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/faw_icon/blob/master/CODE_OF_CONDUCT.md).
73
+ Everyone interacting in the FawIcon project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/alexwebgr/faw_icon/blob/master/CODE_OF_CONDUCT.md).
@@ -4,17 +4,29 @@ module FawIcon
4
4
  def faw_icon(style, name, options = {})
5
5
  fa_prefix = 'fa'
6
6
  html_props = {}
7
+ icons = JSON.parse(File.read('app/assets/javascripts/icons.json'))
8
+ view_box = [0, 0, 512, 512]
9
+ svg_path = '<g><path fill="currentColor" d="M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"></path><circle fill="currentColor" cx="256" cy="364" r="28"><animate attributeType="XML" repeatCount="indefinite" dur="2s" attributeName="r" values="28;14;28;28;14;28;"></animate><animate attributeType="XML" repeatCount="indefinite" dur="2s" attributeName="opacity" values="1;0;1;1;0;1;"></animate></circle><path fill="currentColor" opacity="1" d="M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"><animate attributeType="XML" repeatCount="indefinite" dur="2s" attributeName="opacity" values="1;0;0;0;0;1;"></animate></path><path fill="currentColor" opacity="0" d="M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"><animate attributeType="XML" repeatCount="indefinite" dur="2s" attributeName="opacity" values="0;0;1;1;0;0;"></animate></path></g>'
7
10
 
8
- html_props[:class] = [fa_style(style), "#{fa_prefix}-#{name}"]
11
+ if icons[name].present?
12
+ if icons[name]['svg'][style].present?
13
+ svg_path = "<path d=\"#{icons[name]['svg'][style]['path']}\"/>"
14
+ view_box = icons[name]['svg'][style]['viewBox']
15
+ end
16
+ end
17
+
18
+ html_props[:class] = [fa_style(style), "#{fa_prefix}-#{name}", 'svg-inline--fa']
9
19
  html_props[:class] << "#{fa_prefix}-#{options[:size]}" if options[:size]
10
20
  html_props[:class] << "#{fa_prefix}-fw" if options[:fixed_width]
11
21
  html_props[:class] << "#{fa_prefix}-spin" if options[:spin]
12
22
 
13
23
  tag = []
14
- tag << "<i class='#{html_props[:class].join(' ')}'"
15
- tag << " data-fa-transform='#{options[:transform]}'" if options[:transform]
16
- tag << " data-fa-mask='#{options[:mask]}'" if options[:mask]
17
- tag << '></i>'
24
+ tag << "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"#{view_box.join(' ')}\" class=\"#{html_props[:class].join(' ')}\""
25
+ tag << " data-fa-transform=\"#{options[:transform]}\"" if options[:transform]
26
+ tag << " data-fa-mask=\"#{options[:mask]}\"" if options[:mask]
27
+ tag << '>'
28
+ tag << svg_path
29
+ tag << '</svg>'
18
30
 
19
31
  tag.join( '').html_safe
20
32
  end
@@ -1,3 +1,3 @@
1
1
  module FawIcon
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faw_icon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - alexwebgr
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-23 00:00:00.000000000 Z
11
+ date: 2018-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler