Sha256: 3a15214bbe59ecd5e783c9c9bcf78c2f304d5842985a6b7e4acdcf5e814624ea
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
require 'rails/generators' module Staple class RemoveGenerator < Rails::Generators::Base desc 'remove styles from default' source_root File.join(File.dirname(__FILE__), '..', '..') argument :actions, :type => :array, :default => [] def remove_styles puts "remove from default" gsub_file "app/assets/stylesheets/staple/#{component}.scss", "\n\t#{contents}", "" if contents gsub_file "app/assets/stylesheets/staple/builders/build_#{component}.scss", "\n\t\t#{contents}", "" if contents gsub_file "app/assets/stylesheets/staple/#{component}.scss", "\n\t#{hover}", "" if hover gsub_file "app/assets/stylesheets/staple/builders/build_#{component}.scss", "\n\t\t#{hover}", "" if hover puts "invalid operation. for available actions: rails g staple:list [option]" if !contents end private def contents file = File.join(self.class.source_root, 'source', 'styles', "#{component}", "#{pattern.dasherize}.scss") get_file(file) end def hover file = File.join(self.class.source_root, 'source', 'styles', "#{component}", "#{pattern.dasherize}-hover.scss") get_file(file) end def get_file(file) if File.file?(file) return File.read(file) else return false end end def component actions[0] end def pattern actions[1] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
staple-0.3.0 | lib/staple/remove_generator.rb |
staple-0.2.1 | lib/staple/remove_generator.rb |
staple-0.2.0 | lib/staple/remove_generator.rb |