stimulus-rails 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +86 -1
- data/app/assets/javascripts/stimulus-autoloader.js +1 -1
- data/app/assets/javascripts/stimulus-importmap-autoloader.js +1 -1
- data/app/assets/javascripts/stimulus-loading.js +14 -10
- data/app/assets/javascripts/stimulus.js +83 -53
- data/app/assets/javascripts/stimulus.min.js +1 -1
- data/app/assets/javascripts/stimulus.min.js.map +1 -1
- data/lib/install/stimulus_with_importmap.rb +9 -6
- data/lib/install/stimulus_with_node.rb +1 -1
- data/lib/stimulus/engine.rb +9 -1
- data/lib/stimulus/manifest.rb +1 -1
- data/lib/stimulus/version.rb +1 -1
- metadata +2 -2
@@ -11,9 +11,12 @@ say "Import Stimulus controllers"
|
|
11
11
|
append_to_file "app/javascript/application.js", %(import "controllers"\n)
|
12
12
|
|
13
13
|
say "Pin Stimulus"
|
14
|
-
|
15
|
-
pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
say %(Appending: pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true")
|
15
|
+
append_to_file "config/importmap.rb", %(pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true\n)
|
16
|
+
|
17
|
+
say %(Appending: pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true)
|
18
|
+
append_to_file "config/importmap.rb", %(pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true\n)
|
19
|
+
|
20
|
+
say "Pin all controllers"
|
21
|
+
say %(Appending: pin_all_from "app/javascript/controllers", under: "controllers")
|
22
|
+
append_to_file "config/importmap.rb", %(pin_all_from "app/javascript/controllers", under: "controllers"\n)
|
@@ -11,7 +11,7 @@ if (Rails.root.join("app/javascript/application.js")).exist?
|
|
11
11
|
say "Import Stimulus controllers"
|
12
12
|
append_to_file "app/javascript/application.js", %(import "./controllers"\n)
|
13
13
|
else
|
14
|
-
say %(
|
14
|
+
say %(Couldn't find "app/javascript/application.js".\nYou must import "./controllers" in your JavaScript entrypoint file), :red
|
15
15
|
end
|
16
16
|
|
17
17
|
say "Install Stimulus"
|
data/lib/stimulus/engine.rb
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
module Stimulus
|
2
2
|
class Engine < ::Rails::Engine
|
3
|
+
# If you don't want to precompile Stimulus's assets (e.g., you're using jsbundling),
|
4
|
+
# you can do this in an initializer:
|
5
|
+
#
|
6
|
+
# config.after_initialize do
|
7
|
+
# config.assets.precompile -= Stimulus::Engine::PRECOMPILE_ASSETS
|
8
|
+
# end
|
9
|
+
PRECOMPILE_ASSETS = %w( stimulus.js stimulus.min.js stimulus.min.js.map ).freeze
|
10
|
+
|
3
11
|
initializer "stimulus.assets" do
|
4
12
|
if Rails.application.config.respond_to?(:assets)
|
5
|
-
Rails.application.config.assets.precompile +=
|
13
|
+
Rails.application.config.assets.precompile += PRECOMPILE_ASSETS
|
6
14
|
end
|
7
15
|
end
|
8
16
|
end
|
data/lib/stimulus/manifest.rb
CHANGED
data/lib/stimulus/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stimulus-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Stephenson
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2022-07-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: railties
|