faw_icon 0.6.2 → 0.7.2

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: 8b0005468e9555d36d639101ae0dd657cd1bae0c5baf2d2f7205fc206a2563fe
4
- data.tar.gz: 738a343d552e5155f9faa171ad0f23c8dd1fc1bf7a55350cd53721ad71000bc2
3
+ metadata.gz: 530d32392ac24c1686baa1bbe178f710b9735948d51c7d9e82aaded3be66947a
4
+ data.tar.gz: 6ff1d8c23b59c678a0fa018c129d113f1bfe6d4dffa8012ac8c5dd63b7a7b755
5
5
  SHA512:
6
- metadata.gz: 3dd3c6b0ade33e08037cb727d9c005c2de467b2c07412023e92f64224f5354c7db5661217c4f3e6cfb903575e3ae2fdf93b70b07aee70dbf872ee64d1f385ea2
7
- data.tar.gz: 7f8cbd4412975e7aa6b33e08f66739ef3d39ba545d4c4448f596fcc6cdf0adf6700a05d45a3eb34f045a3836ebb320823ff6c474a9669dd195a0f250cad52e82
6
+ metadata.gz: cb58c0b9a3c8ead54694d7692ca8f6946aa2c30b34996284c8f7baf80b679e2144a37e6411d6e6a58db46a8150a0eb4f6bd459bfb77d0c5224c250eeafc8f575
7
+ data.tar.gz: bed5642565694e3d29d6724880b148a48eb83003dca4e33abc461b6c1b33baff763542e7def3f5bd2f735a6431398ceb29d5738613c5d4c6a871800846715cc6
data/Gemfile.lock CHANGED
@@ -1,16 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- faw_icon (0.6.2)
5
- nokogiri (~> 1.8, >= 1.8.2)
4
+ faw_icon (0.7.2)
6
5
 
7
6
  GEM
8
7
  remote: https://rubygems.org/
9
8
  specs:
10
- mini_portile2 (2.3.0)
11
9
  minitest (5.11.3)
12
- nokogiri (1.8.2)
13
- mini_portile2 (~> 2.3.0)
14
10
  rake (10.5.0)
15
11
 
16
12
  PLATFORMS
data/README.md CHANGED
@@ -6,6 +6,7 @@ By design it does not bundle any icons making it super fast to download and inst
6
6
  as well as providing the ability to use new icons as they become available, custom ones or the PRO collection.
7
7
 
8
8
  [![Gem Version](https://badge.fury.io/rb/faw_icon.svg)](https://badge.fury.io/rb/faw_icon)
9
+ [![Gitter chat](https://img.shields.io/badge/join_the_chat-gitter-brightgreen.svg)](https://gitter.im/faw_icon/Lobby)
9
10
 
10
11
  ## Installation
11
12
 
@@ -44,7 +45,7 @@ The below options are also available for further customization
44
45
  | raw_svg_path | vendor/fa5/raw-svg |
45
46
  | svg_sprites_path | public/fa5/svg-sprites |
46
47
  | source_type | json (json, raw, sprite) |
47
- | icon_not_found | `<svg>...</svg>` |
48
+ | icon_not_found | `<svg>...</svg>` |
48
49
  | default_family_prefix | fa |
49
50
  | default_replacement_class | svg-inline--fa |
50
51
 
@@ -59,7 +60,7 @@ FawIcon.configure do |config|
59
60
  end
60
61
  ```
61
62
 
62
- The configuration option `source_type` is added in this release to address the performance hit from loading large json files
63
+ The configuration option `source_type` was added to address the performance hit from loading large json files
63
64
  from the PRO collection and introduces three ways to include icons in the application.
64
65
 
65
66
  1. `json` load a json file, traverse and find the icon
@@ -71,7 +72,7 @@ They all have pros and cons so choose the one that is right for you.
71
72
  `json` a single file that contains everything however it will have a noticeable impact on performance when used with
72
73
  the PRO collection because of the file size but not so much with the free one or a reduced set.
73
74
 
74
- `raw` requires to push in your codenase all 2.986 icons unless they are hosted in a CDN, AWS or just a different repo.
75
+ `raw` requires to push in your codebase all 2.986 icons unless they are hosted in a CDN, AWS or just a different repo.
75
76
 
76
77
  with `sprite` you only need four files but they can only be served from public folder for the fragment identifier feature to work
77
78
  which makes them available for anyone to download whereas the `raw` ones are 'hidden' in the `vendor` folder.
data/faw_icon.gemspec CHANGED
@@ -24,5 +24,4 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "bundler", "~> 1.16"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "minitest", "~> 5.0"
27
- spec.add_runtime_dependency 'nokogiri', '~> 1.8', '>= 1.8.2'
28
27
  end
@@ -1,5 +1,6 @@
1
1
  require "faw_icon/version"
2
2
  require "faw_icon/configuration"
3
+ require "rexml/document"
3
4
 
4
5
  module FawIcon
5
6
  def faw_icon(style, name, options = {})
@@ -29,8 +30,8 @@ module FawIcon
29
30
  icons = JSON.parse(File.read(FawIcon.configuration.icons_path))
30
31
 
31
32
  if icons[name].present? && icons[name]['svg'][style].present?
32
- doc = Nokogiri::HTML(icons[name]['svg'][style]['raw'])
33
- svg = doc.at_css 'svg'
33
+ doc = REXML::Document.new(icons[name]['svg'][style]['raw'])
34
+ svg = doc.root
34
35
  end
35
36
 
36
37
  fa_tag(svg, html_props)
@@ -38,8 +39,8 @@ module FawIcon
38
39
 
39
40
  def by_raw(style, name, html_props)
40
41
  if File.exists? Rails.root.join(FawIcon.configuration.raw_svg_path, style, "#{name}.svg")
41
- doc = File.open(Rails.root.join(FawIcon.configuration.raw_svg_path, style, "#{name}.svg")) { |f| Nokogiri::HTML(f) }
42
- svg = doc.at_css 'svg'
42
+ doc = File.open(Rails.root.join(FawIcon.configuration.raw_svg_path, style, "#{name}.svg")) { |f| REXML::Document.new(f) }
43
+ svg = doc.root
43
44
  end
44
45
 
45
46
  fa_tag(svg, html_props)
@@ -47,21 +48,21 @@ module FawIcon
47
48
 
48
49
  def by_sprite(style, name, html_props)
49
50
  if File.exists? Rails.root.join(FawIcon.configuration.svg_sprites_path, "fa-#{style}.svg")
50
- doc = Nokogiri::HTML("<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><use xlink:href=\"/fa5/svg-sprites/fa-#{style}.svg##{name}\"></use></svg>")
51
- svg = doc.at_css 'svg'
51
+ doc = REXML::Document.new("<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><use href=\"/fa5/svg-sprites/fa-#{style}.svg##{name}\"></use></svg>")
52
+ svg = doc.root
52
53
  end
53
54
 
54
55
  fa_tag(svg, html_props)
55
56
  end
56
57
 
57
58
  def fa_tag(svg = nil, html_props)
58
- svg = icon_not_found if svg.nil?
59
+ svg = svg_not_found if svg.nil?
59
60
 
60
- svg['class'] = html_props[:class].join(' ')
61
- svg['data-fa-transform'] = html_props[:transform] if html_props[:transform]
62
- svg['data-fa-mask'] = html_props[:mask] if html_props[:mask]
61
+ svg.attributes['class'] = html_props[:class].join(' ')
62
+ svg.attributes['data-fa-transform'] = html_props[:transform] if html_props[:transform]
63
+ svg.attributes['data-fa-mask'] = html_props[:mask] if html_props[:mask]
63
64
 
64
- svg.to_html.html_safe
65
+ svg.to_s.html_safe
65
66
  end
66
67
 
67
68
  def fa_style(style)
@@ -77,9 +78,9 @@ module FawIcon
77
78
  end
78
79
  end
79
80
 
80
- def icon_not_found
81
- doc = Nokogiri::HTML(FawIcon.configuration.icon_not_found)
81
+ def svg_not_found
82
+ doc = REXML::Document.new(FawIcon.configuration.svg_not_found)
82
83
 
83
- doc.at_css 'svg'
84
+ doc.root
84
85
  end
85
86
  end
@@ -1,3 +1,3 @@
1
1
  module FawIcon
2
- VERSION = "0.6.2"
2
+ VERSION = "0.7.2"
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.6.2
4
+ version: 0.7.2
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-28 00:00:00.000000000 Z
11
+ date: 2018-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,26 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.0'
55
- - !ruby/object:Gem::Dependency
56
- name: nokogiri
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.8'
62
- - - ">="
63
- - !ruby/object:Gem::Version
64
- version: 1.8.2
65
- type: :runtime
66
- prerelease: false
67
- version_requirements: !ruby/object:Gem::Requirement
68
- requirements:
69
- - - "~>"
70
- - !ruby/object:Gem::Version
71
- version: '1.8'
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: 1.8.2
75
55
  description:
76
56
  email:
77
57
  - email@alex-web.gr