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.
@@ -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
- append_to_file "config/importmap.rb" do <<-RUBY
15
- pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
16
- pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
17
- pin_all_from "app/javascript/controllers", under: "controllers"
18
- RUBY
19
- end
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 %(You must import "./controllers" in your JavaScript entrypoint), :red
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"
@@ -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 += %w( stimulus.js stimulus.min.js stimulus.min.js.map )
13
+ Rails.application.config.assets.precompile += PRECOMPILE_ASSETS
6
14
  end
7
15
  end
8
16
  end
@@ -15,7 +15,7 @@ module Stimulus::Manifest
15
15
 
16
16
  <<-JS
17
17
 
18
- import #{controller_class_name} from "./#{controller_path}"
18
+ import #{controller_class_name} from "./#{module_path}"
19
19
  application.register("#{tag_name}", #{controller_class_name})
20
20
  JS
21
21
  end
@@ -1,3 +1,3 @@
1
1
  module Stimulus
2
- VERSION = "1.0.2"
2
+ VERSION = "1.1.0"
3
3
  end
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.2
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: 2021-12-16 00:00:00.000000000 Z
13
+ date: 2022-07-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties