Method: Sass.compile

Defined in:
lib/sass.rb

.compile(contents, options = {})

Compile a Sass or SCSS string to CSS. Defaults to SCSS.

Parameters:

  • contents (String)

    The contents of the Sass file.

  • options ({Symbol => Object}) (defaults to: {})

    An options hash; see the Sass options documentation

Raises:

  • (Sass::SyntaxError)

    if there's an error in the document

  • (Encoding::UndefinedConversionError)

    if the source encoding cannot be converted to UTF-8

  • (ArgumentError)

    if the document uses an unknown encoding with @charset



55
56
57
58
# File 'lib/sass.rb', line 55

def self.compile(contents, options = {})
  options[:syntax] ||= :scss
  Engine.new(contents, options).to_css
end