Sha256: 5b80387c3c37e6e5a255d951eea491008cf27c349ae7679f641dcf161dea5577

Contents?: true

Size: 854 Bytes

Versions: 1

Compression:

Stored size: 854 Bytes

Contents

require 'rails/generators'

module Foundation
  module Generators
    class LayoutGenerator < Rails::Generators::Base
      source_root File.join(File.dirname(__FILE__), 'templates')
      argument :layout_name, :type => :string, :default => 'application', :banner => 'layout_name'

      class_option :haml, :desc => 'Generate HAML layout instead of ERB.', :type => :boolean
      
      def create_layout
        if options.haml?
          template 'application.html.haml', "app/views/layouts/#{file_name}.html.haml"
        elsif
          template 'application.html.slim', "app/views/layouts/#{file_name}.html.slim"
        else
          template 'application.html.erb', "app/views/layouts/#{file_name}.html.erb"
        end
      end
      
      private
        def file_name
          layout_name.underscore.downcase
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zurb-foundation-3.1.1 lib/foundation/generators/layout_generator.rb