class Sass::Exec::SassConvert
The `sass-convert` executable.
Public Class Methods
new(args)
click to toggle source
@param args [Array<String>] The command-line arguments
Calls superclass method
Sass::Exec::Base.new
# File lib/sass/exec/sass_convert.rb, line 8 def initialize(args) super require 'sass' @options[:for_tree] = {} @options[:for_engine] = {:cache => false, :read_cache => true} end
Public Instance Methods
process_result()
click to toggle source
Processes the options set by the command-line arguments, and runs the CSS compiler appropriately.
Calls superclass method
Sass::Exec::Base#process_result
# File lib/sass/exec/sass_convert.rb, line 36 def process_result require 'sass' if @options[:recursive] process_directory return end super input = @options[:input] if File.directory?(input) raise "Error: '#{input.path}' is a directory (did you mean to use --recursive?)" end output = @options[:output] output = input if @options[:in_place] process_file(input, output) end
set_opts(opts)
click to toggle source
Tells optparse how to parse the arguments.
@param opts [OptionParser]
# File lib/sass/exec/sass_convert.rb, line 18 def set_opts(opts) opts.banner = <<END Usage: sass-convert [options] [INPUT] [OUTPUT] Description: Converts between CSS, indented syntax, and SCSS files. For example, this can convert from the indented syntax to SCSS, or from CSS to SCSS (adding appropriate nesting). END common_options(opts) style(opts) input_and_output(opts) miscellaneous(opts) end