Sha256: 982a96210ba3f30427a19a345d37ddf8203a3bdb468064d118c70b2d89a10ae8
Contents?: true
Size: 737 Bytes
Versions: 16
Compression:
Stored size: 737 Bytes
Contents
# frozen_string_literal: true require "rails/generators/erb" module Erb module Generators class ComponentGenerator < Base source_root File.expand_path("templates", __dir__) class_option :sidecar, type: :boolean, default: false def copy_view_file template "component.html.erb", destination end private def destination if options["sidecar"] File.join("app/components", class_path, "#{file_name}_component", "#{file_name}_component.html.erb") else File.join("app/components", class_path, "#{file_name}_component.html.erb") end end def file_name @_file_name ||= super.sub(/_component\z/i, "") end end end end
Version data entries
16 entries across 16 versions & 1 rubygems