railsui_icon 1.0.2 → 1.0.4

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: f1d88877916de7f125d00aff832af9120c5f3c521102376279c392b0df32b61d
4
- data.tar.gz: 2dcef5885b4a4088120ffab1f3cc1045e5c425807ac48ad2edda35db8a45dac3
3
+ metadata.gz: f2b20a83d52f2e74a09b0cb4adea7b985e58a245838416527db32698446dce8b
4
+ data.tar.gz: dcbd25c4c0cb05a1adb68ca4f1da4cf6cb96c77393e741e702fbbf805258b825
5
5
  SHA512:
6
- metadata.gz: 25cab6978c28b18bb877898df1f078c80393506469c1906fba4cd4a9f2b93eeaf5f52ed928b4b93142d50543dd6d1484114be71ddb5111a51ed516299018fa61
7
- data.tar.gz: 97cae38387c57492f838dc579196a938c9b6de72da5717f53182fcb93ce2c805b85dfa6546af091aba1c2d839edb2acbef87210643d8723e264ea09a99b22253
6
+ metadata.gz: cf94910fd60faa96cad929156fd4176c5d48936be7e713eac65262d8260937446d1b6ec58f4af462263bd798969930696c3ce19ed5b603c60506865ef7133969
7
+ data.tar.gz: e1dd62964ec1ec79bf5cfbbac56e94d96dacfaae9d0aa3021a34cf8503456a8c23d1862653519a3d043748da593d221e019de0eed8e32130e36ad5fb5506cace
@@ -15,6 +15,7 @@ module RailsuiIcon
15
15
 
16
16
  def render
17
17
  if custom_path
18
+ puts "🔥🔥🔥🔥🔥#{custom_path}"
18
19
  render_custom_path(custom_path)
19
20
  else
20
21
  render_standard_icon
@@ -41,9 +42,25 @@ module RailsuiIcon
41
42
  end
42
43
 
43
44
  def render_custom_path(custom_path)
44
- asset_path = "app/assets/images/#{custom_path}"
45
- svg_content = File.read(asset_path)
45
+ return warning if custom_path.blank?
46
+
47
+ if defined?(Railsui::Engine) && Railsui::Engine.root.present?
48
+ engine_asset_path = Railsui::Engine.root.join("app/assets/images#{custom_path}")
49
+
50
+ if File.exist?(engine_asset_path)
51
+ asset_path = engine_asset_path
52
+ end
53
+ end
54
+
55
+ app_asset_path = Rails.root.join("app/assets/images#{custom_path}")
46
56
 
57
+ if File.exist?(app_asset_path)
58
+ asset_path = app_asset_path
59
+ end
60
+
61
+ raise ArgumentError, "Asset path cannot be nil" if asset_path.nil?
62
+
63
+ svg_content = File.read(asset_path)
47
64
  doc = Nokogiri::HTML::DocumentFragment.parse(svg_content)
48
65
  svg = doc.at_css('svg')
49
66
 
@@ -1,3 +1,3 @@
1
1
  module RailsuiIcon
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.4"
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.2
4
+ version: 1.0.4
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-15 00:00:00.000000000 Z
11
+ date: 2024-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails