Sha256: f3cf460a6c0ee1a5fc5df8fd3342d9088e2ac913ef83523d87b6a921d5251322
Contents?: true
Size: 946 Bytes
Versions: 12
Compression:
Stored size: 946 Bytes
Contents
require 'rails/generators' class SassGenerator < Rails::Generators::NamedBase source_root File.expand_path('../templates', __FILE__) desc "This generator creates a coffee script file at "\ "app/assets/stylesheets/partials" argument :elements, type: :array, default: [], banner: "element element" attr_reader :namespace def copy_template_file @namespace = class_name.split("::") @namespace.pop @namespace = @namespace.join("::") template "sass.sass.erb", file_path end private def block_name file_name.underscore end def partial_file_name "_#{file_name}" end def file_path Rails.root.join("app/assets/stylesheets/blocks", partial_file_name + ".sass") end def namespace_path if namespace.blank? return "" else namespace.split("::").map(&:underscore).join("/") + "/" end end def singular_name super.singularize end end
Version data entries
12 entries across 12 versions & 1 rubygems