Sha256: eca7766e3c7df635305eecee54bf57aec92bd6e46acb7cd72de4d4c12d5a1a6c
Contents?: true
Size: 790 Bytes
Versions: 1
Compression:
Stored size: 790 Bytes
Contents
module SCSSBeautifier class CLI def run(args) options = Options.new.parse(args) generate_configuration and return if options[:generate_config] contents = args.first.nil? ? $stdin.read : File.read(args.first) engine = Sass::Engine.new(contents, cache: false, syntax: :scss) tree = engine.to_tree config = Config.new(options[:config]) config.formatters.each do |formatter| formatter.send(:visit, tree) end output = SCSSBeautifier::Convert.visit(tree, config.options, :scss) if options[:in_place] File.write(args.first, output) else puts output end end private def generate_configuration File.write(".scss-beautifier", File.read(Config::DEFAULT)) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
scss_beautifier-0.1.19 | lib/scss_beautifier/cli.rb |