Sha256: fcb0af7623afe80ffbb50d11cb1216d6621dfa109ff9e8d81c6e309a00ef9303

Contents?: true

Size: 782 Bytes

Versions: 2

Compression:

Stored size: 782 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/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"
append_to_file "config/importmap.rb" do <<-RUBY
pin "@hotwired/stimulus", to: "stimulus.js"
pin "@hotwired/stimulus-loading", to: "stimulus-loading.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.7.1 lib/install/stimulus_with_importmap.rb
stimulus-rails-0.7.0 lib/install/stimulus_with_importmap.rb