module ViewComponent::AbstractGenerator
def component_path
def component_path ViewComponent::Base.config.view_component_path end
def copy_view_file
def copy_view_file template "component.html.#{engine_name}", destination unless options["inline"] end
def destination
def destination File.join(destination_directory, "#{destination_file_name}.html.#{engine_name}") end
def destination_directory
def destination_directory if sidecar? File.join(component_path, class_path, destination_file_name) else File.join(component_path, class_path) end end
def destination_file_name
def destination_file_name "#{file_name}_component" end
def file_name
def file_name @_file_name ||= super.sub(/_component\z/i, "") end
def sidecar?
def sidecar? options["sidecar"] || ViewComponent::Base.config.generate.sidecar end
def stimulus?
def stimulus? options["stimulus"] || ViewComponent::Base.config.generate.stimulus_controller end
def stimulus_controller
def stimulus_controller if stimulus? File.join(destination_directory, destination_file_name) .sub("#{component_path}/", "") .tr("_", "-") .gsub("/", "--") end end
def typescript?
def typescript? options["typescript"] || ViewComponent::Base.config.generate.typescript end