Sha256: efba2c87acb3d894edd6d3a8f7ef74050aa6dea73a8a58178918c16c2102dce5
Contents?: true
Size: 843 Bytes
Versions: 12
Compression:
Stored size: 843 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 class_option :inline, type: :boolean, default: false def copy_view_file unless options["inline"] template "component.html.erb", destination end 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
12 entries across 12 versions & 1 rubygems