Class: Stimulus::Generators::ComponentGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
ViewComponent::AbstractGenerator
Defined in:
lib/rails/generators/stimulus/component_generator.rb

Instance Method Summary collapse

Methods included from ViewComponent::AbstractGenerator

#copy_view_file

Instance Method Details

#create_stimulus_controllerObject



14
15
16
# File 'lib/rails/generators/stimulus/component_generator.rb', line 14

def create_stimulus_controller
  template "component_controller.#{filetype}", destination
end

#stimulus_moduleObject



18
19
20
21
22
# File 'lib/rails/generators/stimulus/component_generator.rb', line 18

def stimulus_module
  return "stimulus" if legacy_stimulus?

  "@hotwired/stimulus"
end