Sha256: c0bebd040d315b9a5abc490a4171bc3793a658c48287393a7cf166c2e1d3d4ad

Contents?: true

Size: 688 Bytes

Versions: 2

Compression:

Stored size: 688 Bytes

Contents

# frozen_string_literal: true

require 'rails/generators'

module Railsstrap
  module Generators
    class PartialGenerator < ::Rails::Generators::Base
      source_root File.expand_path('../templates', __FILE__)
      desc 'Generates railsstrap HTML partials'
      argument :component_name, type: :string, default: 'application',
               banner: 'navbar, navbar-devise, carousel'

      attr_reader :app_name

      def generate_partial
        app = ::Rails.application
        ext = app.config.generators.options[:rails][:template_engine] || :erb
        copy_file "_#{component_name}.html.#{ext}", "app/views/shared/_#{component_name}.html.#{ext}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
railsstrap-4.0.0.beta3 lib/generators/railsstrap/partial/partial_generator.rb
railsstrap-4.0.0.beta2 lib/generators/railsstrap/partial/partial_generator.rb