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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +10 -18
- data/lib/fontawesome_cdn/helpers/icon.rb +8 -1
- data/lib/fontawesome_cdn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6a3570d57a5ff55f3e8d76855da20a3d4743aa6d28f074f8195e08f030e16373
|
|
4
|
+
data.tar.gz: d1672f687e2a00fb5dbbff244e7b62e71975e8b8b3f90619a01bad9764154a63
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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
|
|
30
|
+
### 1️⃣ Load Font Awesome
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Place inside your `<head>`:
|
|
32
|
+
**Simply add the helper inside the `<head>` of your layout**:
|
|
35
33
|
|
|
36
34
|
```erb
|
|
37
|
-
|
|
35
|
+
<!-- app/views/layouts/application.html.erb -->
|
|
36
|
+
<head>
|
|
37
|
+
<%= include_font_awesome "7.0.1" %>
|
|
38
|
+
</head>
|
|
38
39
|
```
|
|
39
40
|
|
|
40
|
-
|
|
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
|
-
####
|
|
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
|
-
|
|
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)], " ")
|