faw_icon 0.3.2 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +22 -1
- data/faw_icon.gemspec +1 -1
- data/lib/faw_icon/configuration.rb +24 -0
- data/lib/faw_icon/helper.rb +4 -3
- data/lib/faw_icon/version.rb +1 -1
- data/lib/faw_icon.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9b783bfac785840004b982c9bc0fa71a93e74f82706076a7c6df5911c8b928c
|
4
|
+
data.tar.gz: 4a44897161e5ad7bc9e1c822e9d1217f6552d585c1b16f5848cfd60c94686223
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ab604a4f8ad785d741c2bd2c913799cf0c295716e511bb262ce017fdef3b9417c2336d2b5a4d5b8c75c2c1eb3212eee4a5af4f84ebc60b33e02017cb56e2625
|
7
|
+
data.tar.gz: db39ddd9fd2ffb4818b72f70f253fe961fb903e2d0f259069de427f5623f07faf396f52e10ae22b7b466e2110271e0234bd0ea496d9ecd6ddeec139c7f73b535
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,9 @@
|
|
3
3
|
### Minimalistic ruby gem that exposes a tag helper for Font Awesome icon sets.
|
4
4
|
|
5
5
|
By design it does not bundle any icons making it super fast to download and install
|
6
|
-
as well as providing the ability to use new icons as they become available, custom ones or the PRO collection.
|
6
|
+
as well as providing the ability to use new icons as they become available, custom ones or the PRO collection.
|
7
|
+
|
8
|
+
[](https://badge.fury.io/rb/faw_icon)
|
7
9
|
|
8
10
|
## Installation
|
9
11
|
|
@@ -32,7 +34,26 @@ application.scss
|
|
32
34
|
@import "fa-svg-with-js";
|
33
35
|
|
34
36
|
Then copy the `fontawesome/advanced-options/metadata/icons.json` in `app/assets/javascripts/icons.json`
|
37
|
+
|
38
|
+
## Configuration
|
39
|
+
The below options are also available for further customization
|
40
|
+
|
41
|
+
| Property | Default |
|
42
|
+
|---------------------------|-----------------------------------|
|
43
|
+
| icons_path | app/assets/javascripts/icons.json |
|
44
|
+
| default_family_prefix | fa |
|
45
|
+
| default_replacement_class | svg-inline--fa |
|
46
|
+
|
47
|
+
Simply create an initializer under `/config/initializers/faw_icon.rb` and modify as needed !
|
48
|
+
If you no option is supplied the default will be used
|
35
49
|
|
50
|
+
```ruby
|
51
|
+
FawIcon.configure do |config|
|
52
|
+
config.icons_path = 'app/assets/javascripts/icons.json'
|
53
|
+
config.default_family_prefix = 'fa'
|
54
|
+
config.default_replacement_class = 'svg-inline--fa'
|
55
|
+
end
|
56
|
+
```
|
36
57
|
## Usage
|
37
58
|
All options from [additional-styling](https://fontawesome.com/how-to-use/svg-with-js#additional-styling) are supported with the exception of
|
38
59
|
CSS Pseudo-elements.
|
data/faw_icon.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['alexwebgr']
|
9
9
|
spec.email = ['email@alex-web.gr']
|
10
10
|
|
11
|
-
spec.summary = %q{A simple
|
11
|
+
spec.summary = %q{A simple helper for Font-Awesome 5 using raw SVG}
|
12
12
|
spec.homepage = "https://github.com/alexwebgr/faw_icon"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "faw_icon/version"
|
2
|
+
|
3
|
+
module FawIcon
|
4
|
+
class << self
|
5
|
+
attr_accessor :configuration
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.configure
|
9
|
+
self.configuration ||= Configuration.new
|
10
|
+
yield(configuration)
|
11
|
+
end
|
12
|
+
|
13
|
+
class Configuration
|
14
|
+
attr_accessor :icons_path
|
15
|
+
attr_accessor :default_family_prefix
|
16
|
+
attr_accessor :default_replacement_class
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@icons_path = 'app/assets/javascripts/icons.json'
|
20
|
+
@default_family_prefix = 'fa'
|
21
|
+
@default_replacement_class = 'svg-inline--fa'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/faw_icon/helper.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require "faw_icon/version"
|
2
|
+
require "faw_icon/configuration"
|
2
3
|
|
3
4
|
module FawIcon
|
4
5
|
def faw_icon(style, name, options = {})
|
5
6
|
style = 'brands' if style == 'brand'
|
6
|
-
fa_prefix =
|
7
|
+
fa_prefix = FawIcon.configuration.default_family_prefix
|
7
8
|
html_props = {}
|
8
|
-
icons = JSON.parse(File.read(
|
9
|
+
icons = JSON.parse(File.read(FawIcon.configuration.icons_path))
|
9
10
|
view_box = [0, 0, 512, 512]
|
10
11
|
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>'
|
11
12
|
|
@@ -16,7 +17,7 @@ module FawIcon
|
|
16
17
|
end
|
17
18
|
end
|
18
19
|
|
19
|
-
html_props[:class] = [fa_style(style), "#{fa_prefix}-#{name}",
|
20
|
+
html_props[:class] = [fa_style(style), "#{fa_prefix}-#{name}", FawIcon.configuration.default_replacement_class]
|
20
21
|
html_props[:class] << "#{fa_prefix}-#{options[:size]}" if options[:size]
|
21
22
|
html_props[:class] << "#{fa_prefix}-fw" if options[:fixed_width]
|
22
23
|
html_props[:class] << "#{fa_prefix}-spin" if options[:spin]
|
data/lib/faw_icon/version.rb
CHANGED
data/lib/faw_icon.rb
CHANGED
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.
|
4
|
+
version: 0.4.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-
|
11
|
+
date: 2018-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -69,6 +69,7 @@ files:
|
|
69
69
|
- Rakefile
|
70
70
|
- faw_icon.gemspec
|
71
71
|
- lib/faw_icon.rb
|
72
|
+
- lib/faw_icon/configuration.rb
|
72
73
|
- lib/faw_icon/helper.rb
|
73
74
|
- lib/faw_icon/railtie.rb
|
74
75
|
- lib/faw_icon/version.rb
|
@@ -95,5 +96,5 @@ rubyforge_project:
|
|
95
96
|
rubygems_version: 2.7.6
|
96
97
|
signing_key:
|
97
98
|
specification_version: 4
|
98
|
-
summary: A simple
|
99
|
+
summary: A simple helper for Font-Awesome 5 using raw SVG
|
99
100
|
test_files: []
|