Sha256: 8cfd9551eb6c15a30b3bf34921e0f3f0b1f9790e3873b26047d2a5f63db0848b

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

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/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"
append_to_file "config/importmap.rb" do <<-RUBY
pin "@hotwired/stimulus", to: "stimulus.js"
pin "@hotwired/stimulus-importmap-autoloader", to: "stimulus-importmap-autoloader.js"
pin_all_from "app/javascript/controllers", under: "controllers"
RUBY
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
stimulus-rails-0.4.2 lib/install/stimulus_with_importmap.rb
stimulus-rails-0.4.1 lib/install/stimulus_with_importmap.rb