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