Sha256: 13311e0cf04e11d028d5b532fefdfc8528ebb0d704bba6b450bc9dc4faaad578

Contents?: true

Size: 510 Bytes

Versions: 24

Compression:

Stored size: 510 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__)

      def copy_view_file
        template "component.html.haml", File.join("app/components", class_path, "#{file_name}_component.html.haml")
      end

      private

      def file_name
        @_file_name ||= super.sub(/_component\z/i, "")
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
view_component-2.15.0 lib/rails/generators/haml/component_generator.rb
view_component-2.14.1 lib/rails/generators/haml/component_generator.rb
view_component-2.14.0 lib/rails/generators/haml/component_generator.rb
view_component-2.13.0 lib/rails/generators/haml/component_generator.rb
view_component-2.12.0 lib/rails/generators/haml/component_generator.rb
view_component-2.11.1 lib/rails/generators/haml/component_generator.rb
view_component-2.11.0 lib/rails/generators/haml/component_generator.rb
view_component-2.10.0 lib/rails/generators/haml/component_generator.rb
view_component-2.9.0 lib/rails/generators/haml/component_generator.rb
view_component-2.8.0 lib/rails/generators/haml/component_generator.rb
view_component-2.7.0 lib/rails/generators/haml/component_generator.rb
view_component-2.6.0 lib/rails/generators/haml/component_generator.rb
view_component-2.5.1 lib/rails/generators/haml/component_generator.rb
view_component-2.5.0 lib/rails/generators/haml/component_generator.rb
view_component-2.4.0 lib/rails/generators/haml/component_generator.rb
view_component-2.3.0 lib/rails/generators/haml/component_generator.rb
view_component-2.2.2 lib/rails/generators/haml/component_generator.rb
view_component-2.2.1 lib/rails/generators/haml/component_generator.rb
view_component-2.2.0 lib/rails/generators/haml/component_generator.rb
view_component-2.1.0 lib/rails/generators/haml/component_generator.rb