voidable-hotwire 0.3.2 → 0.3.3

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: 917e81dd9ab63c3f13e8a4226e81fff90b8a04acfbda37d3b894a5b7832a1d96
4
- data.tar.gz: e23eb1c641b73a8f7521d9162cee645e72f55a6505ce40f03acaf53fb3103030
3
+ metadata.gz: 383061c49371adb1c779cd6137079515feacc4efd7a0d0c94cfd20433899e92e
4
+ data.tar.gz: 5b56bb49ef638341b2528b1d884ac4c239437dcd4c024c1b39088a1bdaa76153
5
5
  SHA512:
6
- metadata.gz: f284f5e70fe5c1597bb4684bdfb504c8c56484e1e1e6387ade3651df5f014e5fc808dc840109b69613b1a8fc2a1867d9deaed784bcc4c0a3433caa4e1f206d0a
7
- data.tar.gz: 310d7e1c6289ae689e50d5253a09ad8b19dad6364b9521cd7c2dd3bdb80d6b68a9743d55a83291076b19eff385b5def7ef375dd3b2d1d6e06693262b4738a3fc
6
+ metadata.gz: 7c8776a82f85f8466393d6970d6213336c919767db5ebe0b04d9edacdea5002bc610efc52e0d55b106e5b38dd43f93e5d74a2f3512ca56e7e2bdff64ba04be7e
7
+ data.tar.gz: 9997e86f1f8c54f8a3517d629cc7b8cc1dba0d63b5db22d0d2a7c54ed6674023f0704952b402449cda3b05e89d121ddaeb91aab3ff9f0185e332d5f05ce6ab1e
@@ -107,16 +107,25 @@ module Voidable
107
107
  def add_js_import
108
108
  js_entrypoint = "app/javascript/application.js"
109
109
  return unless File.exist?(js_entrypoint)
110
- return if File.read(js_entrypoint).include?("@voidable/ui")
111
- prepend_to_file js_entrypoint, "import \"@voidable/ui\";\nimport \"@voidable/ui-hotwire\";\n\n"
112
- if vite?
113
- append_to_file js_entrypoint, <<~JS
110
+ contents = File.read(js_entrypoint)
111
+ unless contents.include?("@voidable/ui")
112
+ prepend_to_file js_entrypoint, "import \"@voidable/ui\";\nimport \"@voidable/ui-hotwire\";\n\n"
113
+ end
114
+ if vite? && !contents.include?("voidable-layout.js")
115
+ css_imports = %w[./application.css]
116
+ case options[:layout]
117
+ when "switching"
118
+ css_imports << "./voidable-layout-topbar.css"
119
+ css_imports << "./voidable-layout-sidebar.css"
120
+ else
121
+ css_imports << "./voidable-layout.css"
122
+ end
123
+ css_imports << "./voidable-devise.css"
114
124
 
115
- import "@voidable/theme";
116
- import "./voidable-layout.css";
117
- import "./voidable-devise.css";
118
- import "./voidable-layout.js";
119
- JS
125
+ imports = css_imports.map { |f| "import \"#{f}\";" }.join("\n")
126
+ imports += "\nimport \"@voidable/theme\";"
127
+ imports += "\nimport \"./voidable-layout.js\";"
128
+ append_to_file js_entrypoint, "\n#{imports}\n"
120
129
  end
121
130
  say "Added Voidable imports to application.js", :green
122
131
  end
@@ -1,5 +1,5 @@
1
1
  module Voidable
2
2
  module Hotwire
3
- VERSION = "0.3.2"
3
+ VERSION = "0.3.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: voidable-hotwire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaz Walker