Sha256: 719074bc7c4b3efcb358dc0b1f0e719908635b5c0768dbaf9ea90e776626d06b

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

say "Create controllers directory"
empty_directory "app/javascript/controllers"
copy_file "#{__dir__}/app/javascript/controllers/index_for_importmap.js",
  "app/javascript/controllers/index.js"
copy_file "#{__dir__}/app/javascript/controllers/application.js",
  "app/javascript/controllers/application.js"
copy_file "#{__dir__}/app/javascript/controllers/hello_controller.js",
  "app/javascript/controllers/hello_controller.js"

say "Import Stimulus controllers"
append_to_file "app/javascript/application.js", %(import "controllers"\n)

say "Pin Stimulus"
say %(Appending: pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true")
append_to_file "config/importmap.rb", %(pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true\n)

say %(Appending: pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true)
append_to_file "config/importmap.rb", %(pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true\n)

say "Pin all controllers"
say %(Appending: pin_all_from "app/javascript/controllers", under: "controllers")
append_to_file "config/importmap.rb", %(pin_all_from "app/javascript/controllers", under: "controllers"\n)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
stimulus-rails-1.3.0 lib/install/stimulus_with_importmap.rb
stimulus-rails-1.2.2 lib/install/stimulus_with_importmap.rb
stimulus-rails-1.2.1 lib/install/stimulus_with_importmap.rb
stimulus-rails-1.2.0 lib/install/stimulus_with_importmap.rb
stimulus-rails-1.1.1 lib/install/stimulus_with_importmap.rb
stimulus-rails-1.1.0 lib/install/stimulus_with_importmap.rb
stimulus-rails-1.0.4 lib/install/stimulus_with_importmap.rb
stimulus-rails-1.0.3 lib/install/stimulus_with_importmap.rb