railsui_icon 1.0.0 → 1.0.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: baab21cf3d7e083200c74e1edb06316601ceb02bd1e017b7b6e8eb774e0adbd7
4
- data.tar.gz: af39f357c1c666ead3169e841a89712672e7a8c484ac20b6587480c0c78b69a2
3
+ metadata.gz: f1d88877916de7f125d00aff832af9120c5f3c521102376279c392b0df32b61d
4
+ data.tar.gz: 2dcef5885b4a4088120ffab1f3cc1045e5c425807ac48ad2edda35db8a45dac3
5
5
  SHA512:
6
- metadata.gz: ef5420b719937b189601da6a42998de01c0d3ea12f132e34d165178e0ffdc0c649883e4177f310cd9485de90b612ec6e1632c2d01e5188bd1d78d6e7f78240e7
7
- data.tar.gz: b0f5dae245da6754d7ce28f86e17d0b6c56cefe2b35dd4f6046a9dcb6047f3153849caf7d6ea215b6615a6f85974cdc4e5a0bad1d77872c6b6f1522bd4c34df8
6
+ metadata.gz: 25cab6978c28b18bb877898df1f078c80393506469c1906fba4cd4a9f2b93eeaf5f52ed928b4b93142d50543dd6d1484114be71ddb5111a51ed516299018fa61
7
+ data.tar.gz: 97cae38387c57492f838dc579196a938c9b6de72da5717f53182fcb93ce2c805b85dfa6546af091aba1c2d839edb2acbef87210643d8723e264ea09a99b22253
data/README.md CHANGED
@@ -104,7 +104,7 @@ If you set default classes in your configuration you can disable those explicitl
104
104
 
105
105
  **Pass a custom icon path**
106
106
 
107
- Additional icons can be sourced from `app/assets/images`. Pass a custom path to render those. It's assumed the icon will be the `.svg` format.
107
+ Additional icons can be sourced from `app/assets/images`. Pass a custom path to render those. It's assumed the icon will be the `.svg` format. The path should be relative with a leading slash.
108
108
 
109
109
  - An icon name or nil value for the name is still required.
110
110
  - The file suffix is required in this scenario.
@@ -112,14 +112,14 @@ Additional icons can be sourced from `app/assets/images`. Pass a custom path to
112
112
  ```erb
113
113
  <!-- Resolves from app/assets/images/logo.svg -->
114
114
 
115
- <%= icon "logo", custom_path: "logo.svg" %>
115
+ <%= icon "logo", custom_path: "/logo.svg" %>
116
116
 
117
117
  ```
118
118
 
119
119
  **The kitchen sink**
120
120
 
121
121
  ```erb
122
- <%= icon "star", variant: :micro, class: "size-3 fill-current text-pink-500", custom_path: "my_icons/star.svg", disable_default_class: true %>
122
+ <%= icon "star", variant: :micro, class: "size-3 fill-current text-pink-500", custom_path: "/my_icons/star.svg", disable_default_class: true %>
123
123
  ```
124
124
 
125
125
  ## Bugs
@@ -19,7 +19,11 @@ module RailsuiIcon
19
19
  def resolve_custom_path(path)
20
20
  return unless path
21
21
 
22
- path
22
+ if Rails.application.config.assets.paths.any? { |p| path.start_with?(p) }
23
+ path
24
+ else
25
+ ActionController::Base.helpers.asset_path(path)
26
+ end
23
27
  end
24
28
  end
25
29
  end
@@ -1,3 +1,3 @@
1
1
  module RailsuiIcon
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railsui_icon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Leverenz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-06 00:00:00.000000000 Z
11
+ date: 2024-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails