fontawesome_cdn 1.0.0 → 1.1.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: 6a3570d57a5ff55f3e8d76855da20a3d4743aa6d28f074f8195e08f030e16373
4
+ data.tar.gz: d1672f687e2a00fb5dbbff244e7b62e71975e8b8b3f90619a01bad9764154a63
5
5
  SHA512:
6
- metadata.gz: c71799ae50fc7baf58f5057d58e96f047f079fff04ce4a97bc919b3769c4e3ba8a401c07cc1280980e2d0e2583246a3589c71184da9d6f736fddcf9e10dc0fda
7
- data.tar.gz: de8a29cdc724e752652a6f116ed0010ad76eff35952a810b343b71eeaf22d87ff759937b6c9a1a9734c025e8b10ebce2d8391baac9a4dcac59ae63eb6ca749c7
6
+ metadata.gz: 2aeeda5c1970e61f55e7dcd77170117b7eb16cbaab06de19df4518ee5fa93143b1e56df0c0a6203fae0880cba2966bf3c434319316ba50a9f48f5d8410815d59
7
+ data.tar.gz: d6d70f2d163927def278fdb3e86714105f0786409e29d81b4884a5feca1eb71b17b9311596c1466f8665f056e5c811b2973dff7c9db5ceb15fd0a915eb7d2a32
data/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@ This project follows [Semantic Versioning](https://semver.org).
6
6
 
7
7
  ---
8
8
 
9
+ ## 1.1.0
10
+
11
+ ### Added
12
+ - Allow passing arbitrary HTML attributes (e.g. style, data, title) to the `icon` helper
13
+
14
+ ---
15
+
9
16
  ## 1.0.0
10
17
 
11
18
  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.0.1" %>
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
 
@@ -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)], " ")
@@ -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.1.0"
6
6
  end
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.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenCodeForge