module Sass

def self.compile(contents, options = {})

Raises:
  • (ArgumentError) - if the document uses an unknown encoding with `@charset`
  • (Encoding::UndefinedConversionError) - if the source encoding
  • (Sass::SyntaxError) - if there's an error in the document

Parameters:
  • options ({Symbol => Object}) -- An options hash;
  • contents (String) -- The contents of the Sass file.
def self.compile(contents, options = {})
  options[:syntax] ||= :scss
  Engine.new(contents, options).to_css
end

def self.compile_file(filename, *args)

Parameters:
  • css_filename (String) -- The location to which to write the compiled CSS.
  • options ({Symbol => Object}) -- An options hash;
  • filename (String) -- The path to the Sass, SCSS, or CSS file on disk.

Overloads:
  • compile_file(filename, css_filename, options = {})
  • compile_file(filename, options = {})

Returns:
  • (String) - The compiled CSS.

Raises:
  • (ArgumentError) - if the document uses an unknown encoding with `@charset`
  • (Encoding::UndefinedConversionError) - if the source encoding
  • (Sass::SyntaxError) - if there's an error in the document
def self.compile_file(filename, *args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  css_filename = args.shift
  result = Sass::Engine.for_file(filename, options).render
  if css_filename
    options[:css_filename] ||= css_filename
    open(css_filename,"w") {|css_file| css_file.write(result)}
    nil
  else
    result
  end
end

def self.load_paths

Returns:
  • (Array) -
def self.load_paths
  @load_paths ||= ENV['SASS_PATH'] ?
    ENV['SASS_PATH'].split(Sass::Util.windows? ? ';' : ':') : []
end