Sha256: 8a5c9995092260aa39cff1eb724f45a64293632868c2767a09f1474bcf35850d

Contents?: true

Size: 912 Bytes

Versions: 18

Compression:

Stored size: 912 Bytes

Contents

module Tao
  module Generators
    class SassGenerator < Rails::Generators::NamedBase
      source_root File.expand_path('../templates', __FILE__)

      argument :actions, type: :array, default: %w(index new edit show), banner: "action action"

      class_option :variants, type: :array, default: [], desc: "Generate assets for different variants"

      attr_reader :page_id

      def create_sass_file
        actions.each do |action|
          @page_id = [class_path, file_name, action].flatten.join('-')
          if (variants = options[:variants]).any?
            variants.each do |variant|
              template "sass.erb", File.join("app/assets/stylesheets", variant, name.pluralize, "#{action}_page.scss")
            end
          else
            template "sass.erb", File.join('app/assets/stylesheets', name.pluralize, "#{action}_page.scss")
          end
        end
      end

    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
tao_on_rails-0.10.0 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.9.3 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.9.2 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.9.1 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.9.0 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.8.2 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.8.1 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.6.12 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.6.11 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.6.10 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.6.9 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.6.8 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.6.7 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.6.6 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.6.5 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.6.4 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.6.3 lib/generators/tao/sass/sass_generator.rb
tao_on_rails-0.6.2 lib/generators/tao/sass/sass_generator.rb