Class: Phlex::Stimulus::Generators::ControllerGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Phlex::Stimulus::Generators::ControllerGenerator
- Includes:
- GeneratorMixin
- Defined in:
- lib/generators/phlex/stimulus/controller/controller_generator.rb
Instance Method Summary collapse
-
#create_files ⇒ Object
: -> void.
Instance Method Details
#create_files ⇒ Object
: -> void
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/generators/phlex/stimulus/controller/controller_generator.rb', line 13 def create_files template 'controller.ts.erb', File.join(destination_root, 'app', 'javascript', 'controllers', class_path, "#{file_name}_controller.ts") template 'component.rb.erb', File.join(destination_root, 'app', 'components', class_path, "#{file_name}_controller.rb") append_to_file File.join(destination_root, 'app', 'javascript', 'controllers', 'index.ts'), "import \"./#{class_path}/#{file_name}_controller\"\n" end |