Sha256: d1ecf31448f9af6665224fd8c96fc1bfb9131a351bac8ff29f81dff2d46af6b1

Contents?: true

Size: 698 Bytes

Versions: 1

Compression:

Stored size: 698 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

1 entries across 1 versions & 1 rubygems

Version Path
stimulus-rails-0.4.0 lib/install/stimulus_with_importmap.rb