Sha256: 4d8edaddffdc76c0bb6a64e67d0c2aa19e5465effa48755829e8fb2b548cd0d7

Contents?: true

Size: 808 Bytes

Versions: 8

Compression:

Stored size: 808 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-importmap-autoloader", to: "stimulus-importmap-autoloader.js"
pin_all_from "app/javascript/controllers", under: "controllers"
RUBY
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
stimulus-rails-0.6.2 lib/install/stimulus_with_importmap.rb
stimulus-rails-0.6.1 lib/install/stimulus_with_importmap.rb
stimulus-rails-0.6.0 lib/install/stimulus_with_importmap.rb
stimulus-rails-0.5.4 lib/install/stimulus_with_importmap.rb
stimulus-rails-0.5.3 lib/install/stimulus_with_importmap.rb
stimulus-rails-0.5.2 lib/install/stimulus_with_importmap.rb
stimulus-rails-0.5.1 lib/install/stimulus_with_importmap.rb
stimulus-rails-0.5.0 lib/install/stimulus_with_importmap.rb