File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
lib/custom_elements/rails Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,23 @@ module CustomElements
22 module Rails
33 class Railtie < ::Rails ::Engine
44 initializer "custom_elements-rails.assets.precompile" do |app |
5- if app . config . respond_to? :assets
5+ if app . config . respond_to? ( :assets )
66 app . config . assets . precompile += %w( custom_elements-rails.js )
77 end
88 end
9+
10+ initializer "custom_elements-rails.spark" , after : "hotwire_spark.config" do |app |
11+ spark_available = app . config . respond_to? ( :hotwire ) && app . config . hotwire . respond_to? ( :spark )
12+ if spark_available
13+ puts "spark_available"
14+ # Custom elements don't seem to work with morphing
15+ Hotwire ::Spark . html_reload_method = :replace
16+
17+ # Just force full reloads after custom element change for now
18+ Hotwire ::Spark . html_paths << ::Rails . root . join ( "app/javascript/custom_elements" ) . to_s
19+ Hotwire ::Spark . html_extensions << "js"
20+ end
21+ end
922 end
1023 end
1124end
You can’t perform that action at this time.
0 commit comments