fontawesome_cdn 1.0.0 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 17a69f882df20af599d2070ad9249f1759d14fc0b14bea47c109b0a15d157d0e
4
- data.tar.gz: 187ff7f8c50fd6edaa022217c4d526ee63f447cd46590b2f037bd76f988189e9
3
+ metadata.gz: 306d56a1d838f49c8562e9ba19cfa4e78c3b69bff7ed8faf29278ee154d1d5a0
4
+ data.tar.gz: c64285e6eb028397add8bec7e144e27802f17c2674b3b47187031d81303a625b
5
5
  SHA512:
6
- metadata.gz: c71799ae50fc7baf58f5057d58e96f047f079fff04ce4a97bc919b3769c4e3ba8a401c07cc1280980e2d0e2583246a3589c71184da9d6f736fddcf9e10dc0fda
7
- data.tar.gz: de8a29cdc724e752652a6f116ed0010ad76eff35952a810b343b71eeaf22d87ff759937b6c9a1a9734c025e8b10ebce2d8391baac9a4dcac59ae63eb6ca749c7
6
+ metadata.gz: 2627ac7dd97576da79344fb0a1dc6b1e30c9f1260b3af61d4d565e598560294424be3eb785c433d825ee427a2d5285f6fef20679a80b689d1b5d389c3ee036d6
7
+ data.tar.gz: afec018157fcf89dffd5b5dc0d2192fcad389250aacec02b78e037decf767d835e3c457c6bea30d6d67667003288a7ed37d73b9478828bfc0731988a51a8dd18
data/CHANGELOG.md CHANGED
@@ -6,6 +6,21 @@ This project follows [Semantic Versioning](https://semver.org).
6
6
 
7
7
  ---
8
8
 
9
+ ## 1.2.0
10
+
11
+ ### Added
12
+ - Added cdnjs support with verified SRI hashes for Font Awesome 7.1.0, 7.2.0, and 7.3.0.
13
+ - Added Ruby 4.0.6 to the CI test matrix.
14
+
15
+ ---
16
+
17
+ ## 1.1.0
18
+
19
+ ### Added
20
+ - Allow passing arbitrary HTML attributes (e.g. style, data, title) to the `icon` helper
21
+
22
+ ---
23
+
9
24
  ## 1.0.0
10
25
 
11
26
  This release marks the **first stable version** of FontawesomeCdn.
data/README.md CHANGED
@@ -8,7 +8,7 @@ Simple Rails helpers to load **Font Awesome via CDN or Kit**, and render icons i
8
8
  ✅ Supports **Font Awesome Free (CDN)**
9
9
  ✅ Supports **Font Awesome Pro (Kit)**
10
10
  ✅ Compatible with **Font Awesome 7**
11
- ✅ Compatible with **Rails 7 and 8**
11
+ ✅ Compatible with **Rails 8**
12
12
  ✅ No asset pipeline required
13
13
 
14
14
  ---
@@ -27,25 +27,23 @@ bundle install
27
27
 
28
28
  ## 🚀 Usage
29
29
 
30
- ### 1️⃣ Load Font Awesome (in your layout)
30
+ ### 1️⃣ Load Font Awesome
31
31
 
32
- #### **Option A — Load from cdnjs (Font Awesome Free)**
33
-
34
- Place inside your `<head>`:
32
+ **Simply add the helper inside the `<head>` of your layout**:
35
33
 
36
34
  ```erb
37
- <%= include_font_awesome "7.0.1" %>
35
+ <!-- app/views/layouts/application.html.erb -->
36
+ <head>
37
+ <%= include_font_awesome "7.3.0" %>
38
+ </head>
38
39
  ```
39
40
 
40
- This generates:
41
-
42
- ```html
43
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/7.0.1/css/all.min.css" ...>
44
- ```
41
+ 👉 Loads Font Awesome from cdnjs
42
+ 👉 Recommended for Font Awesome Free
45
43
 
46
44
  ---
47
45
 
48
- #### **Option B — Load a Font Awesome Kit (supports Pro)**
46
+ #### Alternative — Load a Font Awesome Kit
49
47
 
50
48
  If you have a Font Awesome Pro subscription, you can load your Kit:
51
49
 
@@ -53,12 +51,6 @@ If you have a Font Awesome Pro subscription, you can load your Kit:
53
51
  <%= include_font_awesome kit: "YOUR-KIT-ID" %>
54
52
  ```
55
53
 
56
- This generates:
57
-
58
- ```html
59
- <script src="https://kit.fontawesome.com/YOUR-KIT-ID.js" crossorigin="anonymous"></script>
60
- ```
61
-
62
54
  👉 Use this method for **Font Awesome Pro**
63
55
  👉 The kit automatically loads your own selection (Pro icons, subsets, etc.)
64
56
 
@@ -112,6 +104,9 @@ Defaults:
112
104
 
113
105
  These versions are loaded via **cdnjs** and include verified SRI hashes:
114
106
 
107
+ - **7.3.0**
108
+ - **7.2.0**
109
+ - **7.1.0**
115
110
  - **7.0.1**
116
111
  - **7.0.0**
117
112
  - **6.7.2**
@@ -47,6 +47,7 @@ module FontawesomeCdn
47
47
  FontawesomeCdn.configuration.default_aria_hidden
48
48
  end
49
49
 
50
+ # "special" options we consume
50
51
  class_tokens = options.delete(:class).to_s.split
51
52
  fa_tokens = options.delete(:fa).to_s.split.map { |t| "fa-#{t}" }
52
53
 
@@ -70,7 +71,13 @@ module FontawesomeCdn
70
71
  classes << "fa-#{name}"
71
72
  classes.concat(tokens)
72
73
 
73
- icon_tag = content_tag(:i, nil, class: classes.uniq.join(" "), "aria-hidden": aria_hidden)
74
+ # keep remaining options as HTML attributes (style, data, id, title, ...)
75
+ html_options = options.merge(
76
+ class: classes.uniq.join(" "),
77
+ "aria-hidden": aria_hidden
78
+ )
79
+
80
+ icon_tag = content_tag(:i, nil, **html_options)
74
81
  return icon_tag if text.nil? || text.to_s.empty?
75
82
 
76
83
  safe_join([icon_tag, ERB::Util.html_escape(text.to_s)], " ")
@@ -5,7 +5,7 @@ module FontawesomeCdn
5
5
  module Helpers
6
6
  # Helper for loading Font Awesome
7
7
  #
8
- # <%= include_font_awesome "7.0.1" %>
8
+ # <%= include_font_awesome "7.3.0" %>
9
9
  # # => <link rel="stylesheet" ...> to cdnjs
10
10
  #
11
11
  # <%= include_font_awesome kit: "YOUR-KIT" %>
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Current version of the FontawesomeCdn gem.
4
4
  module FontawesomeCdn
5
- VERSION = "1.0.0"
5
+ VERSION = "1.2.0"
6
6
  end
@@ -15,6 +15,9 @@ module FontawesomeCdn
15
15
  # Font Awesome versions supported by the gem
16
16
  # SRI hashes provided by cdnjs for all.min.css
17
17
  CDN_INTEGRITY_MAP = {
18
+ "7.3.0" => "sha512-ApSLB1Pd3/bZN8fWB/RG9YhN/7bd9Hkf3AGaE2mPfebjrxagjuBtx2GcgdqIlJkUzwylBo61r9Xa9NmgBI0swA==",
19
+ "7.2.0" => "sha512-nMJjQudb6RMMr08oY6YSfNlEWl1l8XWuoOwNvtWXrrgVs8MCR8AZBB1tEAO+ogiI93gXtG1XPmg+bAP5DochSA==",
20
+ "7.1.0" => "sha512-59mflmEHdfG3+iNat6Jg0HZPgYcAhZ7q0VO+q50sfkQDMBpoaSJfjJU2HuH5aBeMZyTwfKB54G8hratLP3Jsow==",
18
21
  "7.0.1" => "sha512-2SwdPD6INVrV/lHTZbO2nodKhrnDdJK9/kg2XD1r9uGqPo1cUbujc+IYdlYdEErWNu69gVcYgdxlmVmzTWnetw==",
19
22
  "7.0.0" => "sha512-DxV+EoADOkOygM4IR9yXP8Sb2qwgidEmeqAEmDKIOfPRQZOWbXCzLC6vjbZyy0vPisbH2SyW27+ddLVCN+OMzQ==",
20
23
  "6.7.2" => "sha512-Evv84Mr4kqVGRNSgIGL/F/aIDqQb7xQ2vcrdIwxfjThSH8CSR7PBEakCr51Ck+w+/U6swU2Im1vVX0SVk9ABhg=="
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fontawesome_cdn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenCodeForge
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  - !ruby/object:Gem::Version
73
73
  version: '0'
74
74
  requirements: []
75
- rubygems_version: 3.7.2
75
+ rubygems_version: 4.0.10
76
76
  specification_version: 4
77
77
  summary: Rails helpers to load Font Awesome via CDN or Kit and render icons in views
78
78
  test_files: []