class Sass::Exec::SassScss

The `sass` and `scss` executables.

Attributes

default_syntax[R]

Public Class Methods

new(args, default_syntax) click to toggle source

@param args [Array<String>] The command-line arguments

Calls superclass method Sass::Exec::Base.new
# File lib/sass/exec/sass_scss.rb, line 7
def initialize(args, default_syntax)
  super(args)
  @options[:sourcemap] = :auto
  @options[:for_engine] = {
    :load_paths => default_sass_path
  }
  @default_syntax = default_syntax
end

Protected Instance Methods

process_result() click to toggle source

Processes the options set by the command-line arguments, and runs the Sass compiler appropriately.

Calls superclass method Sass::Exec::Base#process_result
# File lib/sass/exec/sass_scss.rb, line 37
def process_result
  require 'sass'

  if !@options[:update] && !@options[:watch] &&
      @args.first && colon_path?(@args.first)
    if @args.size == 1
      @args = split_colon_path(@args.first)
    else
      @options[:update] = true
    end
  end
  load_compass if @options[:compass]
  return interactive if @options[:interactive]
  return watch_or_update if @options[:watch] || @options[:update]
  super

  if @options[:sourcemap] != :none && @options[:output_filename]
    @options[:sourcemap_filename] = Sass::Util.sourcemap_name(@options[:output_filename])
  end

  @options[:for_engine][:filename] = @options[:filename]
  @options[:for_engine][:css_filename] = @options[:output] if @options[:output].is_a?(String)
  @options[:for_engine][:sourcemap_filename] = @options[:sourcemap_filename]
  @options[:for_engine][:sourcemap] = @options[:sourcemap]

  run
end
set_opts(opts) click to toggle source

Tells optparse how to parse the arguments.

@param opts [OptionParser]

# File lib/sass/exec/sass_scss.rb, line 21
    def set_opts(opts)
      opts.banner = <<END
Usage: #{default_syntax} [options] [INPUT] [OUTPUT]

Description:
  Converts SCSS or Sass files to CSS.
END

      common_options(opts)
      watching_and_updating(opts)
      input_and_output(opts)
      miscellaneous(opts)
    end